com.applovin.adview.AppLovinIncentivizedInterstitial Java Examples
The following examples show how to use
com.applovin.adview.AppLovinIncentivizedInterstitial.
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 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 #2
Source File: AppLovinMediationAdapter.java From googleads-mobile-android-mediation with Apache License 2.0 | 4 votes |
@Override public void loadRewardedAd( MediationRewardedAdConfiguration mediationRewardedAdConfiguration, final MediationAdLoadCallback<MediationRewardedAd, MediationRewardedAdCallback> mediationAdLoadCallback) { adConfiguration = mediationRewardedAdConfiguration; Context context = adConfiguration.getContext(); if (!(context instanceof Activity)) { String adapterError = createAdapterError( ERROR_CONTEXT_NOT_ACTIVITY, "AppLovin requires an Activity context to load ads."); log(ERROR, "Failed to load rewarded ad from AppLovin: " + adapterError); mediationAdLoadCallback.onFailure(adapterError); return; } if (mediationRewardedAdConfiguration.getBidResponse().equals("")) { isRtbAd = false; } if (!isRtbAd) { synchronized (INCENTIVIZED_ADS_LOCK) { Bundle serverParameters = adConfiguration.getServerParameters(); mZoneId = AppLovinUtils.retrieveZoneId(serverParameters); mSdk = AppLovinUtils.retrieveSdk(serverParameters, context); mNetworkExtras = adConfiguration.getMediationExtras(); mMediationAdLoadCallback = mediationAdLoadCallback; String logMessage = String.format("Requesting rewarded video for zone '%s'", mZoneId); log(DEBUG, logMessage); // Check if incentivized ad for zone already exists. if (INCENTIVIZED_ADS.containsKey(mZoneId)) { mIncentivizedInterstitial = INCENTIVIZED_ADS.get(mZoneId); String errorMessage = createAdapterError( ERROR_AD_ALREADY_REQUESTED, "Cannot load multiple ads with the same Zone ID. " + "Display one ad before attempting to load another."); log(ERROR, errorMessage); mMediationAdLoadCallback.onFailure(errorMessage); } else { // If this is a default Zone, create the incentivized ad normally if (DEFAULT_ZONE.equals(mZoneId)) { mIncentivizedInterstitial = AppLovinIncentivizedInterstitial.create(mSdk); } // Otherwise, use the Zones API else { mIncentivizedInterstitial = AppLovinIncentivizedInterstitial.create(mZoneId, mSdk); } INCENTIVIZED_ADS.put(mZoneId, mIncentivizedInterstitial); } } mIncentivizedInterstitial.preload(this); } else { mMediationAdLoadCallback = mediationAdLoadCallback; mNetworkExtras = adConfiguration.getMediationExtras(); mSdk = AppLovinUtils.retrieveSdk(adConfiguration.getServerParameters(), context); // Create rewarded video object mIncentivizedInterstitial = AppLovinIncentivizedInterstitial.create(mSdk); // Load ad! mSdk.getAdService().loadNextAdForAdToken(adConfiguration.getBidResponse(), 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 ); }