Integrating AdMob Mediation + Vungle SDK v.1.0-v.4.1 (Android)

Follow this guide to quickly add Vungle Android SDK to the AdMob mediation layer. Including Vungle ads in AdMob mediation requires integrating the Vungle adapter, which enables communication between the AdMob SDK and the Vungle SDK.  

Contents

1. Before you get started...

2. Add your app on the AdMob dashboard

3. Integrate the AdMob SDK into your Android project

4. Integrate the Vungle Adapter and SDK into your Android project

5. Vungle is now on AdMob Mediation

6. Advanced Feature (Optional): Passing Additional Parameters

1. Before you get started…

  • AdMob must be set up before starting this tutorial. To begin, sign up for an AdMob account.
  • The Vungle AdMob Android adapter supports both interstitial and rewarded video placements.

    • Interstitial video ads play automatically at your selected placement. Vungle calls these non-incentivized ads.
    • Rewarded video ads are user opt-in and offer rewards to users in exchange for ad views. Vungle calls these incentivized ads.

  • If you haven't already done so, head over to the Vungle dashboard and add your app to your account. This step is required for you to get your Vungle Application ID. You will use the Vungle App ID to initialize Vungle within AdMob.

2. Add your app on the AdMob dashboard

  1. Log into the AdMob dashboard and click + Monetize New App.

  2. In Step 1 - Select an app, click Search For Your App if your app is live on Google Play Store. If you are adding your app manually, make sure you select Android as Platform.

  3. In Step 2 - Select ad format and ad unit:

    • For Interstitial ads, make sure the Video option is selected, because all Vungle ads are of this nature.



    • For Rewarded Interstitial ads, select the Set a reward option and enter values in the Reward amount and Reward item fields. Vungle does not support the Use third-party ad network settings functionality.

  4. After adding your app, follow this guide to add Vungle as an ad network:

    • Click + New Ad Network and select Vungle from the left panel. Find your Vungle Application ID on the Vungle dashboard (Vungle uses one app ID for both interstitial and rewarded interstitial).

    • For Ad network optimization (Optional), enter the Reporting API key to give AdMob access to your eCPM through the Vungle Reporting API. (Refer to How can I request a Reporting API key? for the key, if you don't have it.)

3. Integrate the AdMob SDK into your Android project

Please follow AdMob’s Get Started in Android Studio guide to integrate AdMob SDK into your Android project. Then continue with AdMob’s Interstitial Ads guide and/or Rewarded Ads: Publishers Get Started guide to request and display ads.

4. Integrate the Vungle Adapter and SDK into your Android project

  1. Download Vungle AdMob Adapter 2.2.0
  2. Download Vungle Android SDK 4.1.0
  3. Add Vungle AdMob adapter (one .aar file) and Vungle SDK (five .jar files) to your project library:
    Screen_Shot_2017-06-06_at_4.10.51_PM.png
  4. Update the app level build.gradle file:
    dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])  // Vungle SDK
      compile(name:'VungleAdapter', 'ext':'aar')  // Vungle Adapter for AdMob
    }
    repositories {
      jcenter()
      flatDir {
          dirs 'libs'
      }
    }
  5. Update the AndroidManifest.xml file for Vungle permissions and activities:

    <manifest>
    ...
    <!-- permissions to download and cache video ads for playback -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application>
    ...
    <!-- Required activities for playback of Vungle video Ads -->

    <activity android:name="com.vungle.publisher.VideoFullScreenAdActivity"
    android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
    <activity android:name="com.vungle.publisher.MraidFullScreenAdActivity"
    android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
    android:theme=
    "@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
    </application>
    </manifest>

5. Vungle is now on AdMob Mediation

Vungle will now be in the default AdMob waterfall, along with any other ad networks you choose. Now all you need to do is test the integration, submit the app, and go live by switching Vungle and AdMob out of Test Mode!

For more general information about the Vungle Android SDK, please refer following guides:

* Please note that onAdLeftApplication() callback is never invoked when an ad is clicked and the browser/ app store is launched.

6. Advanced Feature (Optional): Passing Additional Parameters

Android SDK v4.0.3 and AdMob adapter v2.2.0 supports extra parameters.

Method 

Description

setUserId

Sets unique user ID to be passed to Vungle SDK to be used in server-to-server callback for incentivized ads.

setSoundEnabled

Sets the starting sound state for the ad. If false, video begins muted but user may modify.

Sample integration code:

// build network extras bundle
Bundle extras = new VungleExtrasBuilder()
       .setUserId("userId")
       .setSoundEnabled(false)
       .build();
// build request for reward-based ads
AdRequest rewardedAdRequest = new AdRequest.Builder()
       .addNetworkExtrasBundle(VungleAdapter.class, extras)
       .build();
// load rewarded ad
rewardedAd.loadAd(REWARDED_AD_UNIT_ID, rewardedAdRequest);

// or for interstitial ads
AdRequest interstitialAdRequest = new AdRequest.Builder()
       .addNetworkExtrasBundle(VungleInterstitialAdapter.class, extras)
       .build();
// load interstitial ad
interstitialAd.loadAd(interstitialAdRequest);
Have more questions? Submit a request

Comments