Java Code Examples for com.applovin.sdk.AppLovinSdk#VERSION_CODE
The following examples show how to use
com.applovin.sdk.AppLovinSdk#VERSION_CODE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApplovinAdapter.java From SDK-Network-Adapters with MIT License | 5 votes |
@Override public void initialize(final Context context, final MediationAdRequest adRequest, final String userId, final MediationRewardedVideoAdListener listener, final Bundle serverParameters, final Bundle networkExtras) { // SDK versions BELOW 7.2.0 require a instance of an Activity to be passed in as the context if ( AppLovinSdk.VERSION_CODE < 720 && !( context instanceof Activity ) ) { log( ERROR, "Unable to request AppLovin rewarded video. Invalid context provided." ); listener.onInitializationFailed( this, AdRequest.ERROR_CODE_INVALID_REQUEST ); return; } log( DEBUG, "Initializing AppLovin rewarded video..." ); this.context = context; this.listener = listener; if ( !initialized ) { AppLovinSdk.initializeSdk( context ); AppLovinSdk.getInstance( context ).setPluginVersion( "AdMob-2.2.1" ); initialized = true; } listener.onInitializationSucceeded( this ); }
Example 2
Source File: ApplovinAdapter.java From SDK-Network-Adapters with MIT License | 5 votes |
@Override public void loadAd(final MediationAdRequest adRequest, final Bundle serverParameters, final Bundle networkExtras) { log( DEBUG, "Requesting AppLovin rewarded video with networkExtras: " + networkExtras ); // Zones support is available on AppLovin SDK 7.5.0 and higher final String zoneId; if ( AppLovinSdk.VERSION_CODE >= 750 && networkExtras != null && networkExtras.containsKey( "zone_id" ) ) { zoneId = networkExtras.getString( "zone_id" ); } else { zoneId = DEFAULT_ZONE; } // Check if incentivized ad for zone already exists if ( GLOBAL_INCENTIVIZED_INTERSTITIAL_ADS.containsKey( zoneId ) ) { incentivizedInterstitial = GLOBAL_INCENTIVIZED_INTERSTITIAL_ADS.get( zoneId ); } else { // If this is a default Zone, create the incentivized ad normally if ( DEFAULT_ZONE.equals( zoneId ) ) { incentivizedInterstitial = AppLovinIncentivizedInterstitial.create( this.context ); } // Otherwise, use the Zones API else { incentivizedInterstitial = AppLovinIncentivizedInterstitial.create( zoneId, AppLovinSdk.getInstance( this.context ) ); } GLOBAL_INCENTIVIZED_INTERSTITIAL_ADS.put( zoneId, incentivizedInterstitial ); } incentivizedInterstitial.preload( this ); }
Example 3
Source File: AppLovinCustomEventRewardedVideo.java From SDK-Network-Adapters with MIT License | 4 votes |
@Override protected void loadWithSdkInitialized(@NonNull final Activity activity, @NonNull final Map<String, Object> localExtras, @NonNull final Map<String, String> serverExtras) throws Exception { log( DEBUG, "Requesting AppLovin banner with serverExtras: " + serverExtras + " and localExtras: " + localExtras ); // Pass the user consent from the MoPub SDK as per GDPR PersonalInfoManager personalInfoManager = MoPub.getPersonalInformationManager(); if ( personalInfoManager != null && personalInfoManager.gdprApplies() ) { boolean canCollectPersonalInfo = personalInfoManager.canCollectPersonalInformation(); AppLovinPrivacySettings.setHasUserConsent( canCollectPersonalInfo, activity.getApplicationContext() ); } parentActivity = activity; // Zones support is available on AppLovin SDK 7.5.0 and higher final String zoneId; if ( AppLovinSdk.VERSION_CODE >= 750 && serverExtras != null && serverExtras.containsKey( "zone_id" ) ) { zoneId = serverExtras.get( "zone_id" ); } else { zoneId = DEFAULT_ZONE; } // Check if incentivized ad for zone already exists if ( GLOBAL_INCENTIVIZED_INTERSTITIAL_ADS.containsKey( zoneId ) ) { incentivizedInterstitial = GLOBAL_INCENTIVIZED_INTERSTITIAL_ADS.get( zoneId ); } else { // If this is a default Zone, create the incentivized ad normally if ( DEFAULT_ZONE.equals( zoneId ) ) { incentivizedInterstitial = AppLovinIncentivizedInterstitial.create( activity ); } // Otherwise, use the Zones API else { incentivizedInterstitial = AppLovinIncentivizedInterstitial.create( zoneId, sdk ); } GLOBAL_INCENTIVIZED_INTERSTITIAL_ADS.put( zoneId, incentivizedInterstitial ); } incentivizedInterstitial.preload( this ); }
Example 4
Source File: AppLovinCustomEventInterstitial.java From SDK-Network-Adapters with MIT License | 4 votes |
@Override public void loadInterstitial(final Context context, final CustomEventInterstitialListener listener, final Map<String, Object> localExtras, final Map<String, String> serverExtras) { log( DEBUG, "Requesting AppLovin interstitial with serverExtras: " + serverExtras + " and localExtras: " + localExtras ); // SDK versions BELOW 7.2.0 require a instance of an Activity to be passed in as the context if ( AppLovinSdk.VERSION_CODE < 720 && !( context instanceof Activity ) ) { log( ERROR, "Unable to request AppLovin banner. Invalid context provided." ); listener.onInterstitialFailed( MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR ); return; } // Pass the user consent from the MoPub SDK as per GDPR PersonalInfoManager personalInfoManager = MoPub.getPersonalInformationManager(); if ( personalInfoManager != null && personalInfoManager.gdprApplies() ) { boolean canCollectPersonalInfo = personalInfoManager.canCollectPersonalInformation(); AppLovinPrivacySettings.setHasUserConsent( canCollectPersonalInfo, context ); } // Store parent objects this.listener = listener; this.context = context; sdk = retrieveSdk( serverExtras, context ); sdk.setPluginVersion( "MoPub-3.0.0" ); // Zones support is available on AppLovin SDK 7.5.0 and higher final String serverExtrasZoneId = serverExtras != null ? serverExtras.get( "zone_id" ) : null; zoneId = ( !TextUtils.isEmpty( serverExtrasZoneId ) && AppLovinSdk.VERSION_CODE >= 750 ) ? serverExtrasZoneId : DEFAULT_ZONE; // Check if we already have a preloaded ad for the given zone final AppLovinAd preloadedAd = dequeueAd( zoneId ); if ( preloadedAd != null ) { log( DEBUG, "Found preloaded ad for zone: {" + zoneId + "}" ); adReceived( preloadedAd ); } else { // If this is a default Zone, create the incentivized ad normally if ( DEFAULT_ZONE.equals( zoneId ) ) { sdk.getAdService().loadNextAd( AppLovinAdSize.INTERSTITIAL, this ); } // Otherwise, use the Zones API else { sdk.getAdService().loadNextAdForZoneId( zoneId, this ); } } }
Example 5
Source File: AppLovinCustomEventInterstitial.java From SDK-Network-Adapters with MIT License | 4 votes |
@Override public void requestInterstitialAd(final Context context, final CustomEventInterstitialListener listener, final String serverParameter, final MediationAdRequest mediationAdRequest, final Bundle customEventExtras) { log( DEBUG, "Requesting AppLovin interstitial..." ); // SDK versions BELOW 7.2.0 require a instance of an Activity to be passed in as the context if ( AppLovinSdk.VERSION_CODE < 720 && !( context instanceof Activity ) ) { log( ERROR, "Unable to request AppLovin interstitial. Invalid context provided." ); listener.onAdFailedToLoad( AdRequest.ERROR_CODE_INVALID_REQUEST ); return; } // Store parent objects this.listener = listener; this.context = context; final AppLovinSdk sdk = AppLovinSdk.getInstance( context ); sdk.setPluginVersion( "AdMob-2.2.1" ); // Zones support is available on AppLovin SDK 7.5.0 and higher if ( AppLovinSdk.VERSION_CODE >= 750 && customEventExtras != null && customEventExtras.containsKey( "zone_id" ) ) { zoneId = customEventExtras.getString( "zone_id" ); } else { zoneId = DEFAULT_ZONE; } // Check if we already have a preloaded ad for the given zone final AppLovinAd preloadedAd = dequeueAd( zoneId ); if ( preloadedAd != null ) { log( DEBUG, "Found preloaded ad for zone: {" + zoneId + "}" ); adReceived( preloadedAd ); } else { // If this is a default Zone, load the interstitial ad normally if ( DEFAULT_ZONE.equals( zoneId ) ) { sdk.getAdService().loadNextAd( AppLovinAdSize.INTERSTITIAL, this ); } // Otherwise, use the Zones API else { sdk.getAdService().loadNextAdForZoneId( zoneId, this ); } } }