react-native-applovin-max 3.3.1 → 4.1.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.
- package/android/build.gradle +3 -3
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +52 -1
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +223 -79
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdView.java +416 -0
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdViewManager.java +148 -0
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXPackage.java +2 -1
- package/ios/AppLovinMAX.h +5 -0
- package/ios/AppLovinMAX.m +233 -57
- package/ios/AppLovinMAX.xcodeproj/project.pbxproj +14 -2
- package/ios/AppLovinMAX.xcworkspace/xcuserdata/thomasso.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/AppLovinMAXAdView.h +7 -0
- package/ios/AppLovinMAXAdView.m +50 -2
- package/ios/AppLovinMAXNativeAdView.h +27 -0
- package/ios/AppLovinMAXNativeAdView.m +343 -0
- package/ios/AppLovinMAXNativeAdViewManager.h +19 -0
- package/ios/AppLovinMAXNativeAdViewManager.m +60 -0
- package/ios/Podfile +1 -1
- package/ios/Podfile.lock +4 -4
- package/package.json +1 -1
- package/react-native-applovin-max.podspec +2 -2
- package/src/AppLovinMAXAdView.js +1 -1
- package/src/NativeAdComponents.js +156 -0
- package/src/NativeAdView.js +118 -0
- package/src/NativeAdViewProvider.js +19 -0
- package/src/TargetingData.js +1 -1
- package/src/index.js +383 -55
package/android/build.gradle
CHANGED
|
@@ -41,8 +41,8 @@ android {
|
|
|
41
41
|
defaultConfig {
|
|
42
42
|
minSdkVersion 16
|
|
43
43
|
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
44
|
-
versionCode
|
|
45
|
-
versionName "
|
|
44
|
+
versionCode 4010000
|
|
45
|
+
versionName "4.1.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.5.
|
|
153
|
+
implementation 'com.applovin:applovin-sdk:11.5.5'
|
|
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.
|
|
6
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
|
|
@@ -4,7 +4,11 @@ import android.app.Activity;
|
|
|
4
4
|
import android.content.Context;
|
|
5
5
|
import android.text.TextUtils;
|
|
6
6
|
|
|
7
|
+
import com.applovin.mediation.MaxAd;
|
|
7
8
|
import com.applovin.mediation.MaxAdFormat;
|
|
9
|
+
import com.applovin.mediation.MaxAdListener;
|
|
10
|
+
import com.applovin.mediation.MaxAdViewAdListener;
|
|
11
|
+
import com.applovin.mediation.MaxError;
|
|
8
12
|
import com.applovin.mediation.ads.MaxAdView;
|
|
9
13
|
import com.facebook.react.uimanager.ThemedReactContext;
|
|
10
14
|
import com.facebook.react.views.view.ReactViewGroup;
|
|
@@ -16,6 +20,7 @@ import androidx.annotation.Nullable;
|
|
|
16
20
|
*/
|
|
17
21
|
class AppLovinMAXAdView
|
|
18
22
|
extends ReactViewGroup
|
|
23
|
+
implements MaxAdListener, MaxAdViewAdListener
|
|
19
24
|
{
|
|
20
25
|
private final ThemedReactContext reactContext;
|
|
21
26
|
|
|
@@ -200,7 +205,7 @@ class AppLovinMAXAdView
|
|
|
200
205
|
AppLovinMAXModule.d( "Attaching MaxAdView for " + adUnitId );
|
|
201
206
|
|
|
202
207
|
adView = new MaxAdView( adUnitId, adFormat, AppLovinMAXModule.getInstance().getSdk(), currentActivity );
|
|
203
|
-
adView.setListener(
|
|
208
|
+
adView.setListener( this );
|
|
204
209
|
adView.setRevenueListener( AppLovinMAXModule.getInstance() );
|
|
205
210
|
adView.setPlacement( placement );
|
|
206
211
|
adView.setCustomData( customData );
|
|
@@ -238,4 +243,50 @@ class AppLovinMAXAdView
|
|
|
238
243
|
adView = null;
|
|
239
244
|
}
|
|
240
245
|
}
|
|
246
|
+
|
|
247
|
+
@Override
|
|
248
|
+
public void onAdLoaded(final MaxAd ad)
|
|
249
|
+
{
|
|
250
|
+
AppLovinMAXModule.getInstance().onAdLoaded( ad );
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
@Override
|
|
254
|
+
public void onAdLoadFailed(final String adUnitId, final MaxError error)
|
|
255
|
+
{
|
|
256
|
+
String name = ( adFormat == MaxAdFormat.MREC ) ? "OnMRecAdLoadFailedEvent" : "OnBannerAdLoadFailedEvent";
|
|
257
|
+
|
|
258
|
+
AppLovinMAXModule.getInstance().sendReactNativeEventForAdLoadFailed( name, adUnitId, error );
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
@Override
|
|
262
|
+
public void onAdDisplayFailed(final MaxAd ad, final MaxError error)
|
|
263
|
+
{
|
|
264
|
+
AppLovinMAXModule.getInstance().onAdDisplayFailed( ad, error );
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
@Override
|
|
268
|
+
public void onAdClicked(final MaxAd ad)
|
|
269
|
+
{
|
|
270
|
+
AppLovinMAXModule.getInstance().onAdClicked( ad );
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
@Override
|
|
274
|
+
public void onAdExpanded(final MaxAd ad)
|
|
275
|
+
{
|
|
276
|
+
AppLovinMAXModule.getInstance().onAdExpanded( ad );
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
@Override
|
|
280
|
+
public void onAdCollapsed(final MaxAd ad)
|
|
281
|
+
{
|
|
282
|
+
AppLovinMAXModule.getInstance().onAdCollapsed( ad );
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/// Deprecated Callbacks
|
|
286
|
+
|
|
287
|
+
@Override
|
|
288
|
+
public void onAdDisplayed(final MaxAd ad) {}
|
|
289
|
+
|
|
290
|
+
@Override
|
|
291
|
+
public void onAdHidden(final MaxAd ad) {}
|
|
241
292
|
}
|
|
@@ -32,6 +32,7 @@ import com.applovin.mediation.MaxNetworkResponseInfo;
|
|
|
32
32
|
import com.applovin.mediation.MaxReward;
|
|
33
33
|
import com.applovin.mediation.MaxRewardedAdListener;
|
|
34
34
|
import com.applovin.mediation.ads.MaxAdView;
|
|
35
|
+
import com.applovin.mediation.ads.MaxAppOpenAd;
|
|
35
36
|
import com.applovin.mediation.ads.MaxInterstitialAd;
|
|
36
37
|
import com.applovin.mediation.ads.MaxRewardedAd;
|
|
37
38
|
import com.applovin.sdk.AppLovinAdContentRating;
|
|
@@ -101,9 +102,18 @@ public class AppLovinMAXModule
|
|
|
101
102
|
private Boolean locationCollectionEnabledToSet;
|
|
102
103
|
private final Map<String, String> extraParametersToSet = new HashMap<>( 8 );
|
|
103
104
|
|
|
105
|
+
private Integer targetingYearOfBirthToSet;
|
|
106
|
+
private String targetingGenderToSet;
|
|
107
|
+
private Integer targetingMaximumAdContentRatingToSet;
|
|
108
|
+
private String targetingEmailToSet;
|
|
109
|
+
private String targetingPhoneNumberToSet;
|
|
110
|
+
private ReadableArray targetingKeywordsToSet;
|
|
111
|
+
private ReadableArray targetingInterestsToSet;
|
|
112
|
+
|
|
104
113
|
// Fullscreen Ad Fields
|
|
105
114
|
private final Map<String, MaxInterstitialAd> mInterstitials = new HashMap<>( 2 );
|
|
106
115
|
private final Map<String, MaxRewardedAd> mRewardedAds = new HashMap<>( 2 );
|
|
116
|
+
private final Map<String, MaxAppOpenAd> mAppOpenAds = new HashMap<>( 2 );
|
|
107
117
|
|
|
108
118
|
// Banner Fields
|
|
109
119
|
private final Map<String, MaxAdView> mAdViews = new HashMap<>( 2 );
|
|
@@ -267,6 +277,48 @@ public class AppLovinMAXModule
|
|
|
267
277
|
locationCollectionEnabledToSet = null;
|
|
268
278
|
}
|
|
269
279
|
|
|
280
|
+
if ( targetingYearOfBirthToSet != null )
|
|
281
|
+
{
|
|
282
|
+
sdk.getTargetingData().setYearOfBirth( targetingYearOfBirthToSet <= 0 ? null : targetingYearOfBirthToSet );
|
|
283
|
+
targetingYearOfBirthToSet = null;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if ( targetingGenderToSet != null )
|
|
287
|
+
{
|
|
288
|
+
sdk.getTargetingData().setGender( getAppLovinGender( targetingGenderToSet ) );
|
|
289
|
+
targetingGenderToSet = null;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if ( targetingMaximumAdContentRatingToSet != null )
|
|
293
|
+
{
|
|
294
|
+
sdk.getTargetingData().setMaximumAdContentRating( getAppLovinAdContentRating( targetingMaximumAdContentRatingToSet ) );
|
|
295
|
+
targetingMaximumAdContentRatingToSet = null;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if ( targetingEmailToSet != null )
|
|
299
|
+
{
|
|
300
|
+
sdk.getTargetingData().setEmail( targetingEmailToSet );
|
|
301
|
+
targetingEmailToSet = null;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if ( targetingPhoneNumberToSet != null )
|
|
305
|
+
{
|
|
306
|
+
sdk.getTargetingData().setPhoneNumber( targetingPhoneNumberToSet );
|
|
307
|
+
targetingPhoneNumberToSet = null;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if ( targetingKeywordsToSet != null )
|
|
311
|
+
{
|
|
312
|
+
sdk.getTargetingData().setKeywords( getStringArrayList( targetingKeywordsToSet ) );
|
|
313
|
+
targetingKeywordsToSet = null;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if ( targetingInterestsToSet != null )
|
|
317
|
+
{
|
|
318
|
+
sdk.getTargetingData().setInterests( getStringArrayList( targetingInterestsToSet ) );
|
|
319
|
+
targetingInterestsToSet = null;
|
|
320
|
+
}
|
|
321
|
+
|
|
270
322
|
setPendingExtraParametersIfNeeded( sdk.getSettings() );
|
|
271
323
|
|
|
272
324
|
sdk.initializeSdk( new AppLovinSdk.SdkInitializationListener()
|
|
@@ -495,13 +547,13 @@ public class AppLovinMAXModule
|
|
|
495
547
|
}
|
|
496
548
|
|
|
497
549
|
@ReactMethod()
|
|
498
|
-
public void setConsentFlowEnabled(final boolean enabled) {}
|
|
550
|
+
public void setConsentFlowEnabled(final boolean enabled) { }
|
|
499
551
|
|
|
500
552
|
@ReactMethod()
|
|
501
|
-
public void setPrivacyPolicyUrl(final String urlString) {}
|
|
553
|
+
public void setPrivacyPolicyUrl(final String urlString) { }
|
|
502
554
|
|
|
503
555
|
@ReactMethod()
|
|
504
|
-
public void setTermsOfServiceUrl(final String urlString) {}
|
|
556
|
+
public void setTermsOfServiceUrl(final String urlString) { }
|
|
505
557
|
|
|
506
558
|
// Data Passing
|
|
507
559
|
|
|
@@ -510,7 +562,7 @@ public class AppLovinMAXModule
|
|
|
510
562
|
{
|
|
511
563
|
if ( sdk == null )
|
|
512
564
|
{
|
|
513
|
-
|
|
565
|
+
targetingYearOfBirthToSet = yearOfBirth;
|
|
514
566
|
return;
|
|
515
567
|
}
|
|
516
568
|
|
|
@@ -518,30 +570,15 @@ public class AppLovinMAXModule
|
|
|
518
570
|
}
|
|
519
571
|
|
|
520
572
|
@ReactMethod()
|
|
521
|
-
public void setTargetingDataGender(final String gender)
|
|
573
|
+
public void setTargetingDataGender(@Nullable final String gender)
|
|
522
574
|
{
|
|
523
575
|
if ( sdk == null )
|
|
524
576
|
{
|
|
525
|
-
|
|
577
|
+
targetingGenderToSet = gender;
|
|
526
578
|
return;
|
|
527
579
|
}
|
|
528
580
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
if ( "F".equals( gender ) )
|
|
532
|
-
{
|
|
533
|
-
alGender = AppLovinGender.FEMALE;
|
|
534
|
-
}
|
|
535
|
-
else if ( "M".equals( gender ) )
|
|
536
|
-
{
|
|
537
|
-
alGender = AppLovinGender.MALE;
|
|
538
|
-
}
|
|
539
|
-
else if ( "O".equals( gender ) )
|
|
540
|
-
{
|
|
541
|
-
alGender = AppLovinGender.OTHER;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
sdk.getTargetingData().setGender( alGender );
|
|
581
|
+
sdk.getTargetingData().setGender( getAppLovinGender( gender ) );
|
|
545
582
|
}
|
|
546
583
|
|
|
547
584
|
@ReactMethod()
|
|
@@ -549,34 +586,19 @@ public class AppLovinMAXModule
|
|
|
549
586
|
{
|
|
550
587
|
if ( sdk == null )
|
|
551
588
|
{
|
|
552
|
-
|
|
589
|
+
targetingMaximumAdContentRatingToSet = maximumAdContentRating;
|
|
553
590
|
return;
|
|
554
591
|
}
|
|
555
592
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
if ( maximumAdContentRating == 1 )
|
|
559
|
-
{
|
|
560
|
-
rating = AppLovinAdContentRating.ALL_AUDIENCES;
|
|
561
|
-
}
|
|
562
|
-
else if ( maximumAdContentRating == 2 )
|
|
563
|
-
{
|
|
564
|
-
rating = AppLovinAdContentRating.EVERYONE_OVER_TWELVE;
|
|
565
|
-
}
|
|
566
|
-
else if ( maximumAdContentRating == 3 )
|
|
567
|
-
{
|
|
568
|
-
rating = AppLovinAdContentRating.MATURE_AUDIENCES;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
sdk.getTargetingData().setMaximumAdContentRating( rating );
|
|
593
|
+
sdk.getTargetingData().setMaximumAdContentRating( getAppLovinAdContentRating( maximumAdContentRating ) );
|
|
572
594
|
}
|
|
573
595
|
|
|
574
596
|
@ReactMethod()
|
|
575
|
-
public void setTargetingDataEmail(final String email)
|
|
597
|
+
public void setTargetingDataEmail(@Nullable final String email)
|
|
576
598
|
{
|
|
577
599
|
if ( sdk == null )
|
|
578
600
|
{
|
|
579
|
-
|
|
601
|
+
targetingEmailToSet = email;
|
|
580
602
|
return;
|
|
581
603
|
}
|
|
582
604
|
|
|
@@ -584,11 +606,11 @@ public class AppLovinMAXModule
|
|
|
584
606
|
}
|
|
585
607
|
|
|
586
608
|
@ReactMethod()
|
|
587
|
-
public void setTargetingDataPhoneNumber(final String phoneNumber)
|
|
609
|
+
public void setTargetingDataPhoneNumber(@Nullable final String phoneNumber)
|
|
588
610
|
{
|
|
589
611
|
if ( sdk == null )
|
|
590
612
|
{
|
|
591
|
-
|
|
613
|
+
targetingPhoneNumberToSet = phoneNumber;
|
|
592
614
|
return;
|
|
593
615
|
}
|
|
594
616
|
|
|
@@ -596,49 +618,27 @@ public class AppLovinMAXModule
|
|
|
596
618
|
}
|
|
597
619
|
|
|
598
620
|
@ReactMethod()
|
|
599
|
-
public void setTargetingDataKeywords(final ReadableArray rawKeywords)
|
|
621
|
+
public void setTargetingDataKeywords(@Nullable final ReadableArray rawKeywords)
|
|
600
622
|
{
|
|
601
623
|
if ( sdk == null )
|
|
602
624
|
{
|
|
603
|
-
|
|
625
|
+
targetingKeywordsToSet = rawKeywords;
|
|
604
626
|
return;
|
|
605
627
|
}
|
|
606
628
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
if ( rawKeywords != null )
|
|
610
|
-
{
|
|
611
|
-
keywords = new ArrayList<>( rawKeywords.size() );
|
|
612
|
-
for ( Object rawKeyword : rawKeywords.toArrayList() )
|
|
613
|
-
{
|
|
614
|
-
keywords.add( (String) rawKeyword );
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
sdk.getTargetingData().setKeywords( keywords );
|
|
629
|
+
sdk.getTargetingData().setKeywords( getStringArrayList( rawKeywords ) );
|
|
619
630
|
}
|
|
620
631
|
|
|
621
632
|
@ReactMethod()
|
|
622
|
-
public void setTargetingDataInterests(final ReadableArray rawInterests)
|
|
633
|
+
public void setTargetingDataInterests(@Nullable final ReadableArray rawInterests)
|
|
623
634
|
{
|
|
624
635
|
if ( sdk == null )
|
|
625
636
|
{
|
|
626
|
-
|
|
637
|
+
targetingInterestsToSet = rawInterests;
|
|
627
638
|
return;
|
|
628
639
|
}
|
|
629
640
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
if ( rawInterests != null )
|
|
633
|
-
{
|
|
634
|
-
interests = new ArrayList<>( rawInterests.size() );
|
|
635
|
-
for ( Object rawInterest : rawInterests.toArrayList() )
|
|
636
|
-
{
|
|
637
|
-
interests.add( (String) rawInterest );
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
sdk.getTargetingData().setInterests( interests );
|
|
641
|
+
sdk.getTargetingData().setInterests( getStringArrayList( rawInterests ) );
|
|
642
642
|
}
|
|
643
643
|
|
|
644
644
|
@ReactMethod()
|
|
@@ -646,7 +646,13 @@ public class AppLovinMAXModule
|
|
|
646
646
|
{
|
|
647
647
|
if ( sdk == null )
|
|
648
648
|
{
|
|
649
|
-
|
|
649
|
+
targetingYearOfBirthToSet = null;
|
|
650
|
+
targetingGenderToSet = null;
|
|
651
|
+
targetingMaximumAdContentRatingToSet = null;
|
|
652
|
+
targetingEmailToSet = null;
|
|
653
|
+
targetingPhoneNumberToSet = null;
|
|
654
|
+
targetingKeywordsToSet = null;
|
|
655
|
+
targetingInterestsToSet = null;
|
|
650
656
|
return;
|
|
651
657
|
}
|
|
652
658
|
|
|
@@ -906,6 +912,36 @@ public class AppLovinMAXModule
|
|
|
906
912
|
rewardedAd.setExtraParameter( key, value );
|
|
907
913
|
}
|
|
908
914
|
|
|
915
|
+
// APP OPEN AD
|
|
916
|
+
|
|
917
|
+
@ReactMethod()
|
|
918
|
+
public void loadAppOpenAd(final String adUnitId)
|
|
919
|
+
{
|
|
920
|
+
MaxAppOpenAd appOpenAd = retrieveAppOpenAd( adUnitId );
|
|
921
|
+
appOpenAd.loadAd();
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
925
|
+
public boolean isAppOpenAdReady(final String adUnitId)
|
|
926
|
+
{
|
|
927
|
+
MaxAppOpenAd appOpenAd = retrieveAppOpenAd( adUnitId );
|
|
928
|
+
return appOpenAd.isReady();
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
@ReactMethod()
|
|
932
|
+
public void showAppOpenAd(final String adUnitId, @Nullable final String placement, @Nullable final String customData)
|
|
933
|
+
{
|
|
934
|
+
MaxAppOpenAd appOpenAd = retrieveAppOpenAd( adUnitId );
|
|
935
|
+
appOpenAd.showAd( placement, customData );
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
@ReactMethod()
|
|
939
|
+
public void setAppOpenAdExtraParameter(final String adUnitId, final String key, final String value)
|
|
940
|
+
{
|
|
941
|
+
MaxAppOpenAd appOpenAd = retrieveAppOpenAd( adUnitId );
|
|
942
|
+
appOpenAd.setExtraParameter( key, value );
|
|
943
|
+
}
|
|
944
|
+
|
|
909
945
|
// AD CALLBACKS
|
|
910
946
|
|
|
911
947
|
@Override
|
|
@@ -940,6 +976,14 @@ public class AppLovinMAXModule
|
|
|
940
976
|
{
|
|
941
977
|
name = "OnRewardedAdLoadedEvent";
|
|
942
978
|
}
|
|
979
|
+
else if ( MaxAdFormat.NATIVE == adFormat )
|
|
980
|
+
{
|
|
981
|
+
name = "OnNativeAdLoadedEvent";
|
|
982
|
+
}
|
|
983
|
+
else if ( MaxAdFormat.APP_OPEN == adFormat )
|
|
984
|
+
{
|
|
985
|
+
name = "OnAppOpenAdLoadedEvent";
|
|
986
|
+
}
|
|
943
987
|
else
|
|
944
988
|
{
|
|
945
989
|
logInvalidAdFormat( adFormat );
|
|
@@ -971,6 +1015,10 @@ public class AppLovinMAXModule
|
|
|
971
1015
|
{
|
|
972
1016
|
name = "OnRewardedAdLoadFailedEvent";
|
|
973
1017
|
}
|
|
1018
|
+
else if ( mAppOpenAds.containsKey( adUnitId ) )
|
|
1019
|
+
{
|
|
1020
|
+
name = "OnAppOpenAdLoadFailedEvent";
|
|
1021
|
+
}
|
|
974
1022
|
else
|
|
975
1023
|
{
|
|
976
1024
|
logStackTrace( new IllegalStateException( "invalid adUnitId: " + adUnitId ) );
|
|
@@ -980,7 +1028,7 @@ public class AppLovinMAXModule
|
|
|
980
1028
|
sendReactNativeEventForAdLoadFailed( name, adUnitId, error );
|
|
981
1029
|
}
|
|
982
1030
|
|
|
983
|
-
|
|
1031
|
+
public void sendReactNativeEventForAdLoadFailed(final String name, final String adUnitId, final @Nullable MaxError error)
|
|
984
1032
|
{
|
|
985
1033
|
WritableMap params = Arguments.createMap();
|
|
986
1034
|
params.putString( "adUnitId", adUnitId );
|
|
@@ -1021,6 +1069,14 @@ public class AppLovinMAXModule
|
|
|
1021
1069
|
{
|
|
1022
1070
|
name = "OnRewardedAdClickedEvent";
|
|
1023
1071
|
}
|
|
1072
|
+
else if ( MaxAdFormat.NATIVE == adFormat )
|
|
1073
|
+
{
|
|
1074
|
+
name = "OnNativeAdClickedEvent";
|
|
1075
|
+
}
|
|
1076
|
+
else if ( MaxAdFormat.APP_OPEN == adFormat )
|
|
1077
|
+
{
|
|
1078
|
+
name = "OnAppOpenAdClickedEvent";
|
|
1079
|
+
}
|
|
1024
1080
|
else
|
|
1025
1081
|
{
|
|
1026
1082
|
logInvalidAdFormat( adFormat );
|
|
@@ -1035,17 +1091,21 @@ public class AppLovinMAXModule
|
|
|
1035
1091
|
{
|
|
1036
1092
|
// BMLs do not support [DISPLAY] events
|
|
1037
1093
|
final MaxAdFormat adFormat = ad.getFormat();
|
|
1038
|
-
if ( adFormat != MaxAdFormat.INTERSTITIAL && adFormat != MaxAdFormat.REWARDED ) return;
|
|
1094
|
+
if ( adFormat != MaxAdFormat.INTERSTITIAL && adFormat != MaxAdFormat.REWARDED && adFormat != MaxAdFormat.APP_OPEN ) return;
|
|
1039
1095
|
|
|
1040
1096
|
final String name;
|
|
1041
1097
|
if ( MaxAdFormat.INTERSTITIAL == adFormat )
|
|
1042
1098
|
{
|
|
1043
1099
|
name = "OnInterstitialDisplayedEvent";
|
|
1044
1100
|
}
|
|
1045
|
-
else
|
|
1101
|
+
else if ( MaxAdFormat.REWARDED == adFormat )
|
|
1046
1102
|
{
|
|
1047
1103
|
name = "OnRewardedAdDisplayedEvent";
|
|
1048
1104
|
}
|
|
1105
|
+
else // APP OPEN
|
|
1106
|
+
{
|
|
1107
|
+
name = "OnAppOpenAdDisplayedEvent";
|
|
1108
|
+
}
|
|
1049
1109
|
|
|
1050
1110
|
sendReactNativeEvent( name, getAdInfo( ad ) );
|
|
1051
1111
|
}
|
|
@@ -1055,17 +1115,21 @@ public class AppLovinMAXModule
|
|
|
1055
1115
|
{
|
|
1056
1116
|
// BMLs do not support [DISPLAY] events
|
|
1057
1117
|
final MaxAdFormat adFormat = ad.getFormat();
|
|
1058
|
-
if ( adFormat != MaxAdFormat.INTERSTITIAL && adFormat != MaxAdFormat.REWARDED ) return;
|
|
1118
|
+
if ( adFormat != MaxAdFormat.INTERSTITIAL && adFormat != MaxAdFormat.REWARDED && adFormat != MaxAdFormat.APP_OPEN ) return;
|
|
1059
1119
|
|
|
1060
1120
|
final String name;
|
|
1061
1121
|
if ( MaxAdFormat.INTERSTITIAL == adFormat )
|
|
1062
1122
|
{
|
|
1063
1123
|
name = "OnInterstitialAdFailedToDisplayEvent";
|
|
1064
1124
|
}
|
|
1065
|
-
else
|
|
1125
|
+
else if ( MaxAdFormat.REWARDED == adFormat )
|
|
1066
1126
|
{
|
|
1067
1127
|
name = "OnRewardedAdFailedToDisplayEvent";
|
|
1068
1128
|
}
|
|
1129
|
+
else // APP OPEN
|
|
1130
|
+
{
|
|
1131
|
+
name = "OnAppOpenAdFailedToDisplayEvent";
|
|
1132
|
+
}
|
|
1069
1133
|
|
|
1070
1134
|
WritableMap params = getAdInfo( ad );
|
|
1071
1135
|
params.putInt( "code", error.getCode() );
|
|
@@ -1079,17 +1143,21 @@ public class AppLovinMAXModule
|
|
|
1079
1143
|
{
|
|
1080
1144
|
// BMLs do not support [HIDDEN] events
|
|
1081
1145
|
final MaxAdFormat adFormat = ad.getFormat();
|
|
1082
|
-
if ( adFormat != MaxAdFormat.INTERSTITIAL && adFormat != MaxAdFormat.REWARDED ) return;
|
|
1146
|
+
if ( adFormat != MaxAdFormat.INTERSTITIAL && adFormat != MaxAdFormat.REWARDED && adFormat != MaxAdFormat.APP_OPEN ) return;
|
|
1083
1147
|
|
|
1084
1148
|
String name;
|
|
1085
1149
|
if ( MaxAdFormat.INTERSTITIAL == adFormat )
|
|
1086
1150
|
{
|
|
1087
1151
|
name = "OnInterstitialHiddenEvent";
|
|
1088
1152
|
}
|
|
1089
|
-
else
|
|
1153
|
+
else if ( MaxAdFormat.REWARDED == adFormat )
|
|
1090
1154
|
{
|
|
1091
1155
|
name = "OnRewardedAdHiddenEvent";
|
|
1092
1156
|
}
|
|
1157
|
+
else // APP OPEN
|
|
1158
|
+
{
|
|
1159
|
+
name = "OnAppOpenAdHiddenEvent";
|
|
1160
|
+
}
|
|
1093
1161
|
|
|
1094
1162
|
sendReactNativeEvent( name, getAdInfo( ad ) );
|
|
1095
1163
|
}
|
|
@@ -1141,6 +1209,14 @@ public class AppLovinMAXModule
|
|
|
1141
1209
|
{
|
|
1142
1210
|
name = "OnRewardedAdRevenuePaid";
|
|
1143
1211
|
}
|
|
1212
|
+
else if ( MaxAdFormat.NATIVE == adFormat )
|
|
1213
|
+
{
|
|
1214
|
+
name = "OnNativeAdRevenuePaid";
|
|
1215
|
+
}
|
|
1216
|
+
else if ( MaxAdFormat.APP_OPEN == adFormat )
|
|
1217
|
+
{
|
|
1218
|
+
name = "OnAppOpenAdRevenuePaid";
|
|
1219
|
+
}
|
|
1144
1220
|
else
|
|
1145
1221
|
{
|
|
1146
1222
|
logInvalidAdFormat( adFormat );
|
|
@@ -1559,6 +1635,21 @@ public class AppLovinMAXModule
|
|
|
1559
1635
|
return result;
|
|
1560
1636
|
}
|
|
1561
1637
|
|
|
1638
|
+
private MaxAppOpenAd retrieveAppOpenAd(String adUnitId)
|
|
1639
|
+
{
|
|
1640
|
+
MaxAppOpenAd result = mAppOpenAds.get( adUnitId );
|
|
1641
|
+
if ( result == null )
|
|
1642
|
+
{
|
|
1643
|
+
result = new MaxAppOpenAd( adUnitId, sdk );
|
|
1644
|
+
result.setListener( this );
|
|
1645
|
+
result.setRevenueListener( this );
|
|
1646
|
+
|
|
1647
|
+
mAppOpenAds.put( adUnitId, result );
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
return result;
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1562
1653
|
private MaxAdView retrieveAdView(String adUnitId, MaxAdFormat adFormat)
|
|
1563
1654
|
{
|
|
1564
1655
|
return retrieveAdView( adUnitId, adFormat, null, DEFAULT_AD_VIEW_OFFSET );
|
|
@@ -1813,6 +1904,59 @@ public class AppLovinMAXModule
|
|
|
1813
1904
|
return new Point( AppLovinSdkUtils.dpToPx( context, (int) xDp ), AppLovinSdkUtils.dpToPx( context, (int) yDp ) );
|
|
1814
1905
|
}
|
|
1815
1906
|
|
|
1907
|
+
private static AppLovinGender getAppLovinGender(@Nullable String gender)
|
|
1908
|
+
{
|
|
1909
|
+
if ( gender != null )
|
|
1910
|
+
{
|
|
1911
|
+
if ( "F".equalsIgnoreCase( gender ) )
|
|
1912
|
+
{
|
|
1913
|
+
return AppLovinGender.FEMALE;
|
|
1914
|
+
}
|
|
1915
|
+
else if ( "M".equalsIgnoreCase( gender ) )
|
|
1916
|
+
{
|
|
1917
|
+
return AppLovinGender.MALE;
|
|
1918
|
+
}
|
|
1919
|
+
else if ( "O".equalsIgnoreCase( gender ) )
|
|
1920
|
+
{
|
|
1921
|
+
return AppLovinGender.OTHER;
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
return AppLovinGender.UNKNOWN;
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
private static AppLovinAdContentRating getAppLovinAdContentRating(int maximumAdContentRating)
|
|
1929
|
+
{
|
|
1930
|
+
if ( maximumAdContentRating == 1 )
|
|
1931
|
+
{
|
|
1932
|
+
return AppLovinAdContentRating.ALL_AUDIENCES;
|
|
1933
|
+
}
|
|
1934
|
+
else if ( maximumAdContentRating == 2 )
|
|
1935
|
+
{
|
|
1936
|
+
return AppLovinAdContentRating.EVERYONE_OVER_TWELVE;
|
|
1937
|
+
}
|
|
1938
|
+
else if ( maximumAdContentRating == 3 )
|
|
1939
|
+
{
|
|
1940
|
+
return AppLovinAdContentRating.MATURE_AUDIENCES;
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
return AppLovinAdContentRating.NONE;
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
private List<String> getStringArrayList(@Nullable ReadableArray readableArray)
|
|
1947
|
+
{
|
|
1948
|
+
if ( readableArray == null ) return null;
|
|
1949
|
+
|
|
1950
|
+
List<String> list = new ArrayList<>( readableArray.size() );
|
|
1951
|
+
|
|
1952
|
+
for ( Object item : readableArray.toArrayList() )
|
|
1953
|
+
{
|
|
1954
|
+
list.add( (String) item );
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
return list;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1816
1960
|
// AD INFO
|
|
1817
1961
|
|
|
1818
1962
|
private WritableMap getAdInfo(final MaxAd ad)
|