react-native-applovin-max 4.0.0 → 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/src/main/java/com/applovin/reactnative/AppLovinMAXAdView.java +52 -1
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +208 -81
- package/android/src/main/java/com/applovin/reactnative/AppLovinMAXNativeAdView.java +71 -20
- package/ios/AppLovinMAX.h +2 -2
- package/ios/AppLovinMAX.m +209 -61
- package/ios/AppLovinMAXAdView.m +43 -2
- package/ios/AppLovinMAXNativeAdView.m +42 -7
- 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/TargetingData.js +1 -1
- package/src/index.js +381 -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 "4.
|
|
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
|
}
|
|
@@ -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()
|
|
@@ -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
|
|
@@ -944,6 +980,10 @@ public class AppLovinMAXModule
|
|
|
944
980
|
{
|
|
945
981
|
name = "OnNativeAdLoadedEvent";
|
|
946
982
|
}
|
|
983
|
+
else if ( MaxAdFormat.APP_OPEN == adFormat )
|
|
984
|
+
{
|
|
985
|
+
name = "OnAppOpenAdLoadedEvent";
|
|
986
|
+
}
|
|
947
987
|
else
|
|
948
988
|
{
|
|
949
989
|
logInvalidAdFormat( adFormat );
|
|
@@ -953,11 +993,6 @@ public class AppLovinMAXModule
|
|
|
953
993
|
sendReactNativeEvent( name, getAdInfo( ad ) );
|
|
954
994
|
}
|
|
955
995
|
|
|
956
|
-
public void handleNativeAdLoadFailureForAdUnitId(final String adUnitId, final MaxError error)
|
|
957
|
-
{
|
|
958
|
-
sendReactNativeEventForAdLoadFailed( "OnNativeAdLoadFailedEvent", adUnitId, error );
|
|
959
|
-
}
|
|
960
|
-
|
|
961
996
|
@Override
|
|
962
997
|
public void onAdLoadFailed(final String adUnitId, final MaxError error)
|
|
963
998
|
{
|
|
@@ -980,6 +1015,10 @@ public class AppLovinMAXModule
|
|
|
980
1015
|
{
|
|
981
1016
|
name = "OnRewardedAdLoadFailedEvent";
|
|
982
1017
|
}
|
|
1018
|
+
else if ( mAppOpenAds.containsKey( adUnitId ) )
|
|
1019
|
+
{
|
|
1020
|
+
name = "OnAppOpenAdLoadFailedEvent";
|
|
1021
|
+
}
|
|
983
1022
|
else
|
|
984
1023
|
{
|
|
985
1024
|
logStackTrace( new IllegalStateException( "invalid adUnitId: " + adUnitId ) );
|
|
@@ -989,7 +1028,7 @@ public class AppLovinMAXModule
|
|
|
989
1028
|
sendReactNativeEventForAdLoadFailed( name, adUnitId, error );
|
|
990
1029
|
}
|
|
991
1030
|
|
|
992
|
-
|
|
1031
|
+
public void sendReactNativeEventForAdLoadFailed(final String name, final String adUnitId, final @Nullable MaxError error)
|
|
993
1032
|
{
|
|
994
1033
|
WritableMap params = Arguments.createMap();
|
|
995
1034
|
params.putString( "adUnitId", adUnitId );
|
|
@@ -1034,6 +1073,10 @@ public class AppLovinMAXModule
|
|
|
1034
1073
|
{
|
|
1035
1074
|
name = "OnNativeAdClickedEvent";
|
|
1036
1075
|
}
|
|
1076
|
+
else if ( MaxAdFormat.APP_OPEN == adFormat )
|
|
1077
|
+
{
|
|
1078
|
+
name = "OnAppOpenAdClickedEvent";
|
|
1079
|
+
}
|
|
1037
1080
|
else
|
|
1038
1081
|
{
|
|
1039
1082
|
logInvalidAdFormat( adFormat );
|
|
@@ -1048,17 +1091,21 @@ public class AppLovinMAXModule
|
|
|
1048
1091
|
{
|
|
1049
1092
|
// BMLs do not support [DISPLAY] events
|
|
1050
1093
|
final MaxAdFormat adFormat = ad.getFormat();
|
|
1051
|
-
if ( adFormat != MaxAdFormat.INTERSTITIAL && adFormat != MaxAdFormat.REWARDED ) return;
|
|
1094
|
+
if ( adFormat != MaxAdFormat.INTERSTITIAL && adFormat != MaxAdFormat.REWARDED && adFormat != MaxAdFormat.APP_OPEN ) return;
|
|
1052
1095
|
|
|
1053
1096
|
final String name;
|
|
1054
1097
|
if ( MaxAdFormat.INTERSTITIAL == adFormat )
|
|
1055
1098
|
{
|
|
1056
1099
|
name = "OnInterstitialDisplayedEvent";
|
|
1057
1100
|
}
|
|
1058
|
-
else
|
|
1101
|
+
else if ( MaxAdFormat.REWARDED == adFormat )
|
|
1059
1102
|
{
|
|
1060
1103
|
name = "OnRewardedAdDisplayedEvent";
|
|
1061
1104
|
}
|
|
1105
|
+
else // APP OPEN
|
|
1106
|
+
{
|
|
1107
|
+
name = "OnAppOpenAdDisplayedEvent";
|
|
1108
|
+
}
|
|
1062
1109
|
|
|
1063
1110
|
sendReactNativeEvent( name, getAdInfo( ad ) );
|
|
1064
1111
|
}
|
|
@@ -1068,17 +1115,21 @@ public class AppLovinMAXModule
|
|
|
1068
1115
|
{
|
|
1069
1116
|
// BMLs do not support [DISPLAY] events
|
|
1070
1117
|
final MaxAdFormat adFormat = ad.getFormat();
|
|
1071
|
-
if ( adFormat != MaxAdFormat.INTERSTITIAL && adFormat != MaxAdFormat.REWARDED ) return;
|
|
1118
|
+
if ( adFormat != MaxAdFormat.INTERSTITIAL && adFormat != MaxAdFormat.REWARDED && adFormat != MaxAdFormat.APP_OPEN ) return;
|
|
1072
1119
|
|
|
1073
1120
|
final String name;
|
|
1074
1121
|
if ( MaxAdFormat.INTERSTITIAL == adFormat )
|
|
1075
1122
|
{
|
|
1076
1123
|
name = "OnInterstitialAdFailedToDisplayEvent";
|
|
1077
1124
|
}
|
|
1078
|
-
else
|
|
1125
|
+
else if ( MaxAdFormat.REWARDED == adFormat )
|
|
1079
1126
|
{
|
|
1080
1127
|
name = "OnRewardedAdFailedToDisplayEvent";
|
|
1081
1128
|
}
|
|
1129
|
+
else // APP OPEN
|
|
1130
|
+
{
|
|
1131
|
+
name = "OnAppOpenAdFailedToDisplayEvent";
|
|
1132
|
+
}
|
|
1082
1133
|
|
|
1083
1134
|
WritableMap params = getAdInfo( ad );
|
|
1084
1135
|
params.putInt( "code", error.getCode() );
|
|
@@ -1092,17 +1143,21 @@ public class AppLovinMAXModule
|
|
|
1092
1143
|
{
|
|
1093
1144
|
// BMLs do not support [HIDDEN] events
|
|
1094
1145
|
final MaxAdFormat adFormat = ad.getFormat();
|
|
1095
|
-
if ( adFormat != MaxAdFormat.INTERSTITIAL && adFormat != MaxAdFormat.REWARDED ) return;
|
|
1146
|
+
if ( adFormat != MaxAdFormat.INTERSTITIAL && adFormat != MaxAdFormat.REWARDED && adFormat != MaxAdFormat.APP_OPEN ) return;
|
|
1096
1147
|
|
|
1097
1148
|
String name;
|
|
1098
1149
|
if ( MaxAdFormat.INTERSTITIAL == adFormat )
|
|
1099
1150
|
{
|
|
1100
1151
|
name = "OnInterstitialHiddenEvent";
|
|
1101
1152
|
}
|
|
1102
|
-
else
|
|
1153
|
+
else if ( MaxAdFormat.REWARDED == adFormat )
|
|
1103
1154
|
{
|
|
1104
1155
|
name = "OnRewardedAdHiddenEvent";
|
|
1105
1156
|
}
|
|
1157
|
+
else // APP OPEN
|
|
1158
|
+
{
|
|
1159
|
+
name = "OnAppOpenAdHiddenEvent";
|
|
1160
|
+
}
|
|
1106
1161
|
|
|
1107
1162
|
sendReactNativeEvent( name, getAdInfo( ad ) );
|
|
1108
1163
|
}
|
|
@@ -1158,6 +1213,10 @@ public class AppLovinMAXModule
|
|
|
1158
1213
|
{
|
|
1159
1214
|
name = "OnNativeAdRevenuePaid";
|
|
1160
1215
|
}
|
|
1216
|
+
else if ( MaxAdFormat.APP_OPEN == adFormat )
|
|
1217
|
+
{
|
|
1218
|
+
name = "OnAppOpenAdRevenuePaid";
|
|
1219
|
+
}
|
|
1161
1220
|
else
|
|
1162
1221
|
{
|
|
1163
1222
|
logInvalidAdFormat( adFormat );
|
|
@@ -1576,6 +1635,21 @@ public class AppLovinMAXModule
|
|
|
1576
1635
|
return result;
|
|
1577
1636
|
}
|
|
1578
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
|
+
|
|
1579
1653
|
private MaxAdView retrieveAdView(String adUnitId, MaxAdFormat adFormat)
|
|
1580
1654
|
{
|
|
1581
1655
|
return retrieveAdView( adUnitId, adFormat, null, DEFAULT_AD_VIEW_OFFSET );
|
|
@@ -1830,6 +1904,59 @@ public class AppLovinMAXModule
|
|
|
1830
1904
|
return new Point( AppLovinSdkUtils.dpToPx( context, (int) xDp ), AppLovinSdkUtils.dpToPx( context, (int) yDp ) );
|
|
1831
1905
|
}
|
|
1832
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
|
+
|
|
1833
1960
|
// AD INFO
|
|
1834
1961
|
|
|
1835
1962
|
private WritableMap getAdInfo(final MaxAd ad)
|