Integrating AdMob Mediation + Vungle SDK (Android)

 AdMob Android adapter v6.4.11 is compatible with Vungle Android SDK v6.4.11. Documentation for integrating AdMob Mediation with Vungle SDK (Android) resides on AdMob's Guide section, Integrating Vungle with Mediation.

The instructions for Android Studio integration and manual integration can be found on AdMob's integration guide, Step 3: Import the Vungle SDK and Adapter.

Use this guide as a supplement to AdMob's integration documentation as it has information about new features that are are yet to be covered by the official documentation. AdMob Android adapter v6.4.11 is compatible with Vungle Android SDK v6.4.11 and is tested with Google SDK v17.2.0

If you are updating to Vungle Android SDK v6 using the Google Mobile Ads SDK, you must use Google Play Services Ads v12.0.0 or higher because we have added the onRewardedVideoCompleted() callback method to RewardedVideoAdListener. For more information, refer to the Google Mobile Ads SDK Release Notes.

Ad Format

v6.4.11 onwards supports AdMob’s banner adsTo display a banner ad in the application, create an MREC placement on Vungle dashboard and configure this to a Banner ad unit on AdMob dashboard. Currently, Vungle supports banner size 300*250 and should be specified as MEDIUM_RECTANGLE as AdSize in the implementation.

AdMob allows publishers to use same ad unit ID in multiple places at the same time but Vungle SDK supports only one instance of Banner for a given AdMob ad unit ID at any given time. Please do not attempt to use same Vungle Banner placement reference ID in multiple AdMob ad unit ID since adapter is not designed to handle such case and will lead to unexpected behavior. If you wish to have multiple Vungle Banner instances simultaneously at a given time using Vungle AdMob adapter, we would advise you to create separate ad unit IDs, pointing to different Vungle placements within one Vungle app ID.

Sample code 

AdView adView = new AdView(this);
adViews.add(adView);
adView.setAdSize(AdSize.MEDIUM_RECTANGLE);
adView.setAdUnitId(<AdUnit>);

Network Specific Parameters 

The Vungle AdMob adapter continues to support network specific parameters and v6.4.11 and above will support an additional parameter setAutoRotateEnabled(bool) to play the ad as per device orientation

Sample code 

Bundle extras = new VungleExtrasBuilder(placements)
         
.setSoundEnabled(false)
         
.setUserId("test_user")
.setAutoRotateEnabled(true)
         
.build();
AdRequest request =  new AdRequest.Builder()
         
.addNetworkExtrasBundle(VungleAdapter.class, extras)             // Rewarded video.
         
.addNetworkExtrasBundle(VungleInterstitialAdapter.class, extras) // Interstitial.
         
.build();

Memory Settings

Starting from v6.4.11, you can prevent the SDK from requesting ads or even initializing if the storage of your Android phone falls below a predefined threshold. If this happens, you will get an error similar to the following:

There is not enough file system size on the device. 

Sample code:

import com.vungle.mediation.VungleNetworkSettings;

//Integer value sets the required minimum available free storage space to be able to initialize the SDK
VungleNetworkSettings.setMinSpaceForInit(<INTEGER_VALUE>);

//Integer value sets the required minimum available free storage space to be able to request an ad
VungleNetworkSettings.setMinSpaceForAdLoad(<INTEGER_VALUE>);

Android ID

From SDK v6.4.11 onwards, publishers can now restrict from passing Android ID from the device to the SDK

Sample code 

VungleNetworkSettings.setAndroidIdOptOut(true);

New Rewarded API

As documented in AdMob instruction guide, v17.2.0 and higher supports caching multiple rewarded ads at the same time.

Since Vungle does not support this feature, the Ad request for the second  “Load ad” will not be filled by Vungle, rather it will be passed to the next ad network in the waterfall. 

Was this article helpful?

Questions?

Need further assistance, feel free to reach out to us, we’re here to help!