Early Access - Integrating AdMob + Vungle SDK v 6.5.2 (Android)

AdMob Android adapter 6.5.2.0 is compatible with Vungle Android SDK 6.5.2 and has been tested for compatibility with Google SDK 18.3.0. Documentation for integrating AdMob Mediation with Vungle SDK resides on AdMob's Guide section, Integrating Vungle with Mediation, so use this guide as a supplement for the information about new features that are yet to be covered by the official documentation.

Download AdMob Android Adapter v6.5.2.0 and include Vungle Android SDK 6.5.2, then add them to your project manually. Or you can do Gradle integration through JCenter.

implementation 'com.vungle:publisher-sdk-android:6.5.2'

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, at https://developers.google.com/admob/android/mediation/vungle#step_3_import_the_vungle_sdk_and_adapter.

If you are updating to Vungle Android SDK v6 using the Google Mobile Ads SDK, you must use Google Play Services Ads 12.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

Starting with v6.5.1, Vungle SDK supports AdMob’s banner adsTo display a banner ad in the application, create an MREC or banner placement on Vungle dashboard and configure this to a banner ad unit on AdMob dashboard. Please note that MREC (300dp x 250dp) must have a separate placement reference ID configured as MREC from Vungle dashboard, compared to other banner sizes that is configured as banner.

Supported banner sizes:

Size in dp (WxH) Description AdSize constant
320x50 Banner BANNER
728x90 IAB Leaderboard LEADERBOARD
300x250 IAB Medium Rectangle MEDIUM_RECTANGLE
Provided width x Adaptive height Adaptive banner N/A
Screen width x 32|50|90 Smart banner SMART_BANNER

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 as shown on AdMob's guide. Starting with v6.5.1, audio setting for video play has been replaced by setStartMuted that takes a boolean and setSoundEnabled has been deprecated. The adapter also supports an additional parameter setAdOrientation to play the ad as per device orientation that takes an AdConfig object with LANDSCAPE, PORTRAIT, AUTO_ROTATE and MATCH_VIDEO configurability. (setAutoRotate has been deprecated)

Sample code:

Bundle localExtras = new VungleExtrasBuilder(null)
        .setAdOrientation(AdConfig.LANDSCAPE)
        .setStartMuted(true)
        .setUserId("vungle-test-user")
        .setOrdinalViewCount(77777)
        .build();

For rewarded ads, you will pass VungleAdapter.class on addNetworkExtrasBundle while you will pass VungleInterstitial.class for interstitial ads.

Sample code for loading rewarded ads:

mRewardedAd.loadAd(new AdRequest.Builder()
        .addNetworkExtrasBundle(VungleAdapter.class, localExtras)
        .build(), adLoadCallback);

Sample code for loadinginterstitial ads:

mInterstitialAd.loadAd(new AdRequest.Builder()
        .addNetworkExtrasBundle(VungleInterstitialAdapter.class, localExtras)
        .build());

Memory Settings

Starting with 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

Starting with v6.4.11, 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 attempt won't be filled by Vungle, rather it will be passed to the next ad network in the waterfall.

We recommend that you use cache optimized placement if you want to have more than one ad cached since ad request will be automatically made at the time of ad play, then next ad is highly likely to be ready to be played by the time previous ad experience ends.

Powered by Creativity Driven by Performance Sign Up Here

Questions?

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

Was this article helpful?