react-native-applovin-max 3.3.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/android/build.gradle +4 -4
  2. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  3. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +162 -61
  4. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdViewManager.java +22 -165
  5. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +32 -9
  6. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdView.java +365 -0
  7. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdViewManager.java +148 -0
  8. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXPackage.java +2 -1
  9. package/ios/AppLovinMAX.h +10 -0
  10. package/ios/AppLovinMAX.m +33 -5
  11. package/ios/AppLovinMAX.xcodeproj/project.pbxproj +20 -2
  12. package/ios/AppLovinMAX.xcworkspace/xcuserdata/thomasso.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  13. package/ios/AppLovinMAX.xcworkspace/xcuserdata/thomasso.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +24 -0
  14. package/ios/AppLovinMAXAdView.h +16 -0
  15. package/ios/AppLovinMAXAdView.m +197 -0
  16. package/ios/AppLovinMAXAdViewManager.m +10 -280
  17. package/ios/AppLovinMAXNativeAdView.h +27 -0
  18. package/ios/AppLovinMAXNativeAdView.m +308 -0
  19. package/ios/AppLovinMAXNativeAdViewManager.h +19 -0
  20. package/ios/AppLovinMAXNativeAdViewManager.m +60 -0
  21. package/ios/Podfile +1 -1
  22. package/ios/Podfile.lock +5 -5
  23. package/package.json +1 -1
  24. package/react-native-applovin-max.podspec +2 -2
  25. package/src/AppLovinMAXAdView.js +35 -142
  26. package/src/NativeAdComponents.js +156 -0
  27. package/src/NativeAdView.js +118 -0
  28. package/src/NativeAdViewProvider.js +19 -0
  29. package/src/index.js +3 -1
@@ -16,7 +16,7 @@ buildscript {
16
16
  }
17
17
 
18
18
  dependencies {
19
- classpath 'com.android.tools.build:gradle:3.5.2'
19
+ classpath 'com.android.tools.build:gradle:3.5.4'
20
20
  // noinspection DifferentKotlinGradleVersion
21
21
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
22
22
 
@@ -41,8 +41,8 @@ android {
41
41
  defaultConfig {
42
42
  minSdkVersion 16
43
43
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
44
- versionCode 3030000
45
- versionName "3.3.0"
44
+ versionCode 4000000
45
+ versionName "4.0.0"
46
46
  }
47
47
 
48
48
  flavorDimensions("default")
@@ -150,5 +150,5 @@ dependencies {
150
150
 
151
151
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
152
152
 
153
- implementation 'com.applovin:applovin-sdk:11.4.4'
153
+ implementation 'com.applovin:applovin-sdk:11.5.3'
154
154
  }
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
3
3
  distributionPath=wrapper/dists
4
4
  zipStoreBase=GRADLE_USER_HOME
5
5
  zipStorePath=wrapper/dists
6
- distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
6
+ distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
@@ -19,9 +19,14 @@ class AppLovinMAXAdView
19
19
  {
20
20
  private final ThemedReactContext reactContext;
21
21
 
22
- private MaxAdView adView;
23
- private int currentWidthPx;
24
- private int currentHeightPx;
22
+ private @Nullable MaxAdView adView;
23
+
24
+ private String adUnitId;
25
+ private MaxAdFormat adFormat;
26
+ private @Nullable String placement;
27
+ private @Nullable String customData;
28
+ private boolean adaptiveBannerEnabled;
29
+ private boolean autoRefresh;
25
30
 
26
31
  public AppLovinMAXAdView(final Context context)
27
32
  {
@@ -29,6 +34,93 @@ class AppLovinMAXAdView
29
34
  this.reactContext = (ThemedReactContext) context;
30
35
  }
31
36
 
37
+ public void setAdUnitId(final String value)
38
+ {
39
+ // Ad Unit ID must be set prior to creating MaxAdView
40
+ if ( adView != null )
41
+ {
42
+ AppLovinMAXModule.e( "Attempting to set Ad Unit ID " + value + " after MaxAdView is created" );
43
+ return;
44
+ }
45
+
46
+ adUnitId = value;
47
+
48
+ maybeAttachAdView();
49
+ }
50
+
51
+ public void setAdFormat(final String value)
52
+ {
53
+ // Ad format must be set prior to creating MaxAdView
54
+ if ( adView != null )
55
+ {
56
+ AppLovinMAXModule.e( "Attempting to set ad format " + value + " after MaxAdView is created" );
57
+ return;
58
+ }
59
+
60
+ if ( "banner".equals( value ) )
61
+ {
62
+ adFormat = AppLovinMAXModule.getDeviceSpecificBannerAdViewAdFormat( reactContext );
63
+ }
64
+ else if ( "mrec".equals( value ) )
65
+ {
66
+ adFormat = MaxAdFormat.MREC;
67
+ }
68
+ else
69
+ {
70
+ AppLovinMAXModule.e( "Attempting to set an invalid ad format of \"" + value + "\" for " + adUnitId );
71
+ return;
72
+ }
73
+
74
+ maybeAttachAdView();
75
+ }
76
+
77
+ public void setPlacement(@Nullable final String value)
78
+ {
79
+ placement = value;
80
+
81
+ if ( adView != null )
82
+ {
83
+ adView.setPlacement( placement );
84
+ }
85
+ }
86
+
87
+ public void setCustomData(@Nullable final String value)
88
+ {
89
+ customData = value;
90
+
91
+ if ( adView != null )
92
+ {
93
+ adView.setCustomData( customData );
94
+ }
95
+ }
96
+
97
+ public void setAdaptiveBannerEnabled(final boolean enabled)
98
+ {
99
+ adaptiveBannerEnabled = enabled;
100
+
101
+ if ( adView != null )
102
+ {
103
+ adView.setExtraParameter( "adaptive_banner", Boolean.toString( enabled ) );
104
+ }
105
+ }
106
+
107
+ public void setAutoRefresh(final boolean enabled)
108
+ {
109
+ autoRefresh = enabled;
110
+
111
+ if ( adView != null )
112
+ {
113
+ if ( autoRefresh )
114
+ {
115
+ adView.startAutoRefresh();
116
+ }
117
+ else
118
+ {
119
+ adView.stopAutoRefresh();
120
+ }
121
+ }
122
+ }
123
+
32
124
  @Override
33
125
  public void requestLayout()
34
126
  {
@@ -38,6 +130,9 @@ class AppLovinMAXAdView
38
130
  // This is required to ensure ad refreshes render correctly in RN Android due to known issue where `getWidth()` and `getHeight()` return 0 on attach
39
131
  if ( adView != null )
40
132
  {
133
+ int currentWidthPx = getWidth();
134
+ int currentHeightPx = getHeight();
135
+
41
136
  adView.measure(
42
137
  MeasureSpec.makeMeasureSpec( currentWidthPx, MeasureSpec.EXACTLY ),
43
138
  MeasureSpec.makeMeasureSpec( currentHeightPx, MeasureSpec.EXACTLY )
@@ -68,13 +163,7 @@ class AppLovinMAXAdView
68
163
  }
69
164
  }
70
165
 
71
- @Nullable
72
- protected MaxAdView getAdView()
73
- {
74
- return adView;
75
- }
76
-
77
- public void maybeAttachAdView(final String placement, final String customData, final String adaptiveBannerEnabledStr, final Boolean autoRefreshEnabled, final String adUnitId, final MaxAdFormat adFormat)
166
+ private void maybeAttachAdView()
78
167
  {
79
168
  final Activity currentActivity = reactContext.getCurrentActivity();
80
169
  if ( currentActivity == null )
@@ -83,58 +172,70 @@ class AppLovinMAXAdView
83
172
  return;
84
173
  }
85
174
 
86
- // Run in next run loop when view is laid out and `getWidth()` / `getHeight()` has appropriate values
87
- post( new Runnable()
88
- {
89
- @Override
90
- public void run()
175
+ // Re-assign in case of race condition
176
+ final String adUnitId = this.adUnitId;
177
+ final MaxAdFormat adFormat = this.adFormat;
178
+
179
+ // Run after 0.25 sec delay to allow all properties to set
180
+ postDelayed( () -> {
181
+
182
+ if ( TextUtils.isEmpty( adUnitId ) )
183
+ {
184
+ AppLovinMAXModule.e( "Attempting to attach MaxAdView without Ad Unit ID" );
185
+ return;
186
+ }
187
+
188
+ if ( adFormat == null )
189
+ {
190
+ AppLovinMAXModule.e( "Attempting to attach MaxAdView without ad format" );
191
+ return;
192
+ }
193
+
194
+ if ( adView != null )
195
+ {
196
+ AppLovinMAXModule.e( "Attempting to re-attach with existing MaxAdView: " + adView );
197
+ return;
198
+ }
199
+
200
+ AppLovinMAXModule.d( "Attaching MaxAdView for " + adUnitId );
201
+
202
+ adView = new MaxAdView( adUnitId, adFormat, AppLovinMAXModule.getInstance().getSdk(), currentActivity );
203
+ adView.setListener( AppLovinMAXModule.getInstance() );
204
+ adView.setRevenueListener( AppLovinMAXModule.getInstance() );
205
+ adView.setPlacement( placement );
206
+ adView.setCustomData( customData );
207
+ adView.setExtraParameter( "adaptive_banner", Boolean.toString( adaptiveBannerEnabled ) );
208
+ // Set this extra parameter to work around a SDK bug that ignores calls to stopAutoRefresh()
209
+ adView.setExtraParameter( "allow_pause_auto_refresh_immediately", "true" );
210
+
211
+ if ( autoRefresh )
212
+ {
213
+ adView.startAutoRefresh();
214
+ }
215
+ else
91
216
  {
92
- // If ad unit id and format has been set - create and attach AdView
93
- if ( !TextUtils.isEmpty( adUnitId ) && adFormat != null )
94
- {
95
- // NOTE: AppLovinMAXModule.getInstance().getSdk() may be null
96
- adView = new MaxAdView( adUnitId, adFormat, AppLovinMAXModule.getInstance().getSdk(), currentActivity );
97
- adView.setListener( AppLovinMAXModule.getInstance() );
98
- adView.setRevenueListener( AppLovinMAXModule.getInstance() );
99
-
100
- if ( placement != null )
101
- {
102
- adView.setPlacement( placement );
103
- }
104
-
105
- if ( customData != null )
106
- {
107
- adView.setCustomData( customData );
108
- }
109
-
110
- if ( adaptiveBannerEnabledStr != null )
111
- {
112
- adView.setExtraParameter( "adaptive_banner", adaptiveBannerEnabledStr );
113
- }
114
-
115
- // Set this extra parameter to work around a SDK bug that ignores calls to stopAutoRefresh()
116
- adView.setExtraParameter( "allow_pause_auto_refresh_immediately", "true" );
117
-
118
- if ( autoRefreshEnabled != null )
119
- {
120
- if ( autoRefreshEnabled.booleanValue() )
121
- {
122
- adView.startAutoRefresh();
123
- }
124
- else
125
- {
126
- adView.stopAutoRefresh();
127
- }
128
- }
129
-
130
- adView.loadAd();
131
-
132
- currentWidthPx = getWidth();
133
- currentHeightPx = getHeight();
134
-
135
- addView( adView );
136
- }
217
+ adView.stopAutoRefresh();
137
218
  }
138
- } );
219
+
220
+ adView.loadAd();
221
+
222
+ addView( adView );
223
+ }, 250 );
224
+ }
225
+
226
+ public void destroy()
227
+ {
228
+ if ( adView != null )
229
+ {
230
+ AppLovinMAXModule.d( "Unmounting MaxAdView: " + adView );
231
+
232
+ removeView( adView );
233
+
234
+ adView.setListener( null );
235
+ adView.setRevenueListener( null );
236
+ adView.destroy();
237
+
238
+ adView = null;
239
+ }
139
240
  }
140
241
  }
@@ -1,18 +1,12 @@
1
1
  package com.applovin.reactnative;
2
2
 
3
- import com.applovin.mediation.MaxAdFormat;
4
- import com.applovin.mediation.ads.MaxAdView;
5
3
  import com.facebook.react.bridge.ReactApplicationContext;
6
- import com.facebook.react.bridge.ReadableArray;
7
4
  import com.facebook.react.uimanager.SimpleViewManager;
8
5
  import com.facebook.react.uimanager.ThemedReactContext;
6
+ import com.facebook.react.uimanager.annotations.ReactProp;
9
7
 
10
8
  import org.jetbrains.annotations.NotNull;
11
9
 
12
- import java.util.HashMap;
13
- import java.util.Map;
14
-
15
- import androidx.annotation.NonNull;
16
10
  import androidx.annotation.Nullable;
17
11
 
18
12
  /**
@@ -21,200 +15,63 @@ import androidx.annotation.Nullable;
21
15
  class AppLovinMAXAdViewManager
22
16
  extends SimpleViewManager<AppLovinMAXAdView>
23
17
  {
24
- // Parent fields
25
- private final ReactApplicationContext reactApplicationContext;
26
-
27
- // Maps from the view to the corresponding ad unit id and ad format.
28
- // Both must be set before the MaxAdView is created.
29
- private final Map<AppLovinMAXAdView, String> adUnitIdRegistry = new HashMap<>();
30
- private final Map<AppLovinMAXAdView, MaxAdFormat> adFormatRegistry = new HashMap<>();
31
-
32
- // Storage for placement and extra parameters if set before the MAAdView is created
33
- private final Map<AppLovinMAXAdView, String> placementRegistry = new HashMap<>();
34
- private final Map<AppLovinMAXAdView, String> customDataRegistry = new HashMap<>();
35
- private final Map<AppLovinMAXAdView, String> adaptiveBannerEnabledRegistry = new HashMap<>();
36
- private final Map<AppLovinMAXAdView, Boolean> autoRefreshEnabledRegistry = new HashMap<>();
37
-
38
- public AppLovinMAXAdViewManager(final ReactApplicationContext reactApplicationContext)
39
- {
40
- this.reactApplicationContext = reactApplicationContext;
41
- }
18
+ public AppLovinMAXAdViewManager(final ReactApplicationContext reactApplicationContext) { }
42
19
 
20
+ @NotNull
43
21
  @Override
44
- public @NotNull String getName()
22
+ public String getName()
45
23
  {
46
24
  return "AppLovinMAXAdView";
47
25
  }
48
26
 
27
+ @NotNull
49
28
  @Override
50
- protected @NotNull AppLovinMAXAdView createViewInstance(@NotNull final ThemedReactContext reactContext)
29
+ protected AppLovinMAXAdView createViewInstance(@NotNull final ThemedReactContext reactContext)
51
30
  {
52
31
  // NOTE: Do not set frame or backgroundColor as RN will overwrite the values set by your custom class in order to match your JavaScript component's layout props - hence wrapper
53
32
  return new AppLovinMAXAdView( reactContext );
54
33
  }
55
34
 
56
- @Override
57
- public void receiveCommand(@NonNull AppLovinMAXAdView view, String commandId, @Nullable ReadableArray args)
35
+ @ReactProp(name = "placement")
36
+ public void setPlacement(final AppLovinMAXAdView view, @Nullable final String placement)
58
37
  {
59
- if ( args == null ) return;
60
-
61
- if ( "setAutoRefresh".equals( commandId ) )
62
- {
63
- setAutoRefresh( view, args.getBoolean( 0 ) );
64
- return;
65
- }
66
-
67
- String arg = args.getString( 0 );
68
- if ( arg == null ) return;
69
-
70
- if ( "setPlacement".equals( commandId ) )
71
- {
72
- setPlacement( view, arg );
73
- }
74
- else if ( "setAdaptiveBannerEnabled".equals( commandId ) )
75
- {
76
- setAdaptiveBannerEnabled( view, arg );
77
- }
78
- else if ( "setCustomData".equals( commandId ) )
79
- {
80
- setCustomData( view, arg );
81
- }
82
- else if ( "setAdUnitId".equals( commandId ) )
83
- {
84
- setAdUnitId( view, arg );
85
- }
86
- else if ( "setAdFormat".equals( commandId ) )
87
- {
88
- setAdFormat( view, arg );
89
- }
90
- else
91
- {
92
- AppLovinMAXModule.e( "Unable to parse command: " + commandId + " for AdView: + " + view + " with args: " + args );
93
- }
38
+ view.setPlacement( placement );
94
39
  }
95
40
 
96
- public void setPlacement(final AppLovinMAXAdView view, final String placement)
41
+ @ReactProp(name = "customData")
42
+ public void setCustomData(final AppLovinMAXAdView view, @Nullable final String customData)
97
43
  {
98
- // Post to main thread to avoid race condition with actual creation of MaxAdView in maybeAttachAdView()
99
- view.post( () -> {
100
-
101
- MaxAdView adView = view.getAdView();
102
- if ( adView != null )
103
- {
104
- adView.setPlacement( placement );
105
- }
106
- else
107
- {
108
- placementRegistry.put( view, placement );
109
- }
110
- } );
44
+ view.setCustomData( customData );
111
45
  }
112
46
 
113
- public void setCustomData(final AppLovinMAXAdView view, final String customData)
47
+ @ReactProp(name = "adaptiveBannerEnabled")
48
+ public void setAdaptiveBannerEnabled(final AppLovinMAXAdView view, final boolean enabled)
114
49
  {
115
- // Post to main thread to avoid race condition with actual creation of MaxAdView in maybeAttachAdView()
116
- view.post( () -> {
117
-
118
- MaxAdView adView = view.getAdView();
119
- if ( adView != null )
120
- {
121
- adView.setCustomData( customData );
122
- }
123
- else
124
- {
125
- customDataRegistry.put( view, customData );
126
- }
127
- } );
128
- }
129
-
130
- public void setAdaptiveBannerEnabled(final AppLovinMAXAdView view, final String enabledStr)
131
- {
132
- // Post to main thread to avoid race condition with actual creation of MaxAdView in maybeAttachAdView()
133
- view.post( () -> {
134
-
135
- MaxAdView adView = view.getAdView();
136
- if ( adView != null )
137
- {
138
- adView.setExtraParameter( "adaptive_banner", enabledStr );
139
- }
140
- else
141
- {
142
- adaptiveBannerEnabledRegistry.put( view, enabledStr );
143
- }
144
- } );
50
+ view.setAdaptiveBannerEnabled( enabled );
145
51
  }
146
52
 
53
+ @ReactProp(name = "autoRefresh")
147
54
  public void setAutoRefresh(final AppLovinMAXAdView view, final boolean enabled)
148
55
  {
149
- // Post to main thread to avoid race condition with actual creation of MaxAdView in maybeAttachAdView()
150
- view.post( () -> {
151
-
152
- MaxAdView adView = view.getAdView();
153
- if ( adView != null )
154
- {
155
- if ( enabled )
156
- {
157
- adView.startAutoRefresh();
158
- }
159
- else
160
- {
161
- adView.stopAutoRefresh();
162
- }
163
- }
164
- else
165
- {
166
- autoRefreshEnabledRegistry.put( view, enabled );
167
- }
168
- } );
56
+ view.setAutoRefresh( enabled );
169
57
  }
170
58
 
59
+ @ReactProp(name = "adUnitId")
171
60
  public void setAdUnitId(final AppLovinMAXAdView view, final String adUnitId)
172
61
  {
173
- adUnitIdRegistry.put( view, adUnitId );
174
- maybeAttachAdView( view );
62
+ view.setAdUnitId( adUnitId );
175
63
  }
176
64
 
65
+ @ReactProp(name = "adFormat")
177
66
  public void setAdFormat(final AppLovinMAXAdView view, final String adFormatStr)
178
67
  {
179
- if ( "banner".equals( adFormatStr ) )
180
- {
181
- adFormatRegistry.put( view, AppLovinMAXModule.getDeviceSpecificBannerAdViewAdFormat( reactApplicationContext ) );
182
- }
183
- else if ( "mrec".equals( adFormatStr ) )
184
- {
185
- adFormatRegistry.put( view, MaxAdFormat.MREC );
186
- }
187
-
188
- maybeAttachAdView( view );
189
- }
190
-
191
- private void maybeAttachAdView(final AppLovinMAXAdView view)
192
- {
193
- String placement = placementRegistry.remove( view );
194
- String customData = customDataRegistry.remove( view );
195
- String adaptiveBannerEnabledStr = adaptiveBannerEnabledRegistry.remove( view );
196
- Boolean autoRefreshEnabled = autoRefreshEnabledRegistry.remove( view );
197
-
198
- view.maybeAttachAdView( placement,
199
- customData,
200
- adaptiveBannerEnabledStr,
201
- autoRefreshEnabled,
202
- adUnitIdRegistry.get( view ),
203
- adFormatRegistry.get( view ) );
68
+ view.setAdFormat( adFormatStr );
204
69
  }
205
70
 
206
71
  @Override
207
72
  public void onDropViewInstance(@NotNull AppLovinMAXAdView view)
208
73
  {
209
- // NOTE: Android destroys the native MaxAdView and calls this method while iOS caches it when you remove it from screen
210
- adUnitIdRegistry.remove( view );
211
-
212
- // HACK ALERT: Since current SDK does not respect auto-refresh APIs until _after_ `onAdLoaded()`, explicitly expose view validity to the main module
213
- MaxAdView adView = view.getAdView();
214
- if ( adView != null )
215
- {
216
- AppLovinMAXModule.sAdViewsToRemove.put( adView.getAdUnitId(), adView );
217
- }
74
+ view.destroy();
218
75
 
219
76
  super.onDropViewInstance( view );
220
77
  }
@@ -495,13 +495,13 @@ public class AppLovinMAXModule
495
495
  }
496
496
 
497
497
  @ReactMethod()
498
- public void setConsentFlowEnabled(final boolean enabled) {}
498
+ public void setConsentFlowEnabled(final boolean enabled) { }
499
499
 
500
500
  @ReactMethod()
501
- public void setPrivacyPolicyUrl(final String urlString) {}
501
+ public void setPrivacyPolicyUrl(final String urlString) { }
502
502
 
503
503
  @ReactMethod()
504
- public void setTermsOfServiceUrl(final String urlString) {}
504
+ public void setTermsOfServiceUrl(final String urlString) { }
505
505
 
506
506
  // Data Passing
507
507
 
@@ -931,12 +931,6 @@ public class AppLovinMAXModule
931
931
  {
932
932
  adView.stopAutoRefresh();
933
933
  }
934
-
935
- adView = sAdViewsToRemove.remove( ad.getAdUnitId() );
936
- if ( adView != null )
937
- {
938
- adView.stopAutoRefresh();
939
- }
940
934
  }
941
935
  else if ( MaxAdFormat.INTERSTITIAL == adFormat )
942
936
  {
@@ -946,6 +940,10 @@ public class AppLovinMAXModule
946
940
  {
947
941
  name = "OnRewardedAdLoadedEvent";
948
942
  }
943
+ else if ( MaxAdFormat.NATIVE == adFormat )
944
+ {
945
+ name = "OnNativeAdLoadedEvent";
946
+ }
949
947
  else
950
948
  {
951
949
  logInvalidAdFormat( adFormat );
@@ -955,6 +953,11 @@ public class AppLovinMAXModule
955
953
  sendReactNativeEvent( name, getAdInfo( ad ) );
956
954
  }
957
955
 
956
+ public void handleNativeAdLoadFailureForAdUnitId(final String adUnitId, final MaxError error)
957
+ {
958
+ sendReactNativeEventForAdLoadFailed( "OnNativeAdLoadFailedEvent", adUnitId, error );
959
+ }
960
+
958
961
  @Override
959
962
  public void onAdLoadFailed(final String adUnitId, final MaxError error)
960
963
  {
@@ -1027,6 +1030,10 @@ public class AppLovinMAXModule
1027
1030
  {
1028
1031
  name = "OnRewardedAdClickedEvent";
1029
1032
  }
1033
+ else if ( MaxAdFormat.NATIVE == adFormat )
1034
+ {
1035
+ name = "OnNativeAdClickedEvent";
1036
+ }
1030
1037
  else
1031
1038
  {
1032
1039
  logInvalidAdFormat( adFormat );
@@ -1147,6 +1154,10 @@ public class AppLovinMAXModule
1147
1154
  {
1148
1155
  name = "OnRewardedAdRevenuePaid";
1149
1156
  }
1157
+ else if ( MaxAdFormat.NATIVE == adFormat )
1158
+ {
1159
+ name = "OnNativeAdRevenuePaid";
1160
+ }
1150
1161
  else
1151
1162
  {
1152
1163
  logInvalidAdFormat( adFormat );
@@ -1933,6 +1944,18 @@ public class AppLovinMAXModule
1933
1944
  mRewardedAds.clear();
1934
1945
  }
1935
1946
 
1947
+ // Required methods introduced React Native 0.65
1948
+ //
1949
+ // Without these methods, the following warnings are generated.
1950
+ //
1951
+ // WARN new NativeEventEmitter() was called with a non-null argument without the required addListener method.
1952
+ // WARN new NativeEventEmitter() was called with a non-null argument without the required removeListeners method.
1953
+ @ReactMethod
1954
+ public void addListener(String eventName) { }
1955
+
1956
+ @ReactMethod
1957
+ public void removeListeners(Integer count) { }
1958
+
1936
1959
  // React Native Bridge
1937
1960
 
1938
1961
  private void sendReactNativeEvent(final String name, @Nullable final WritableMap params)