Integrating MoPub + Vungle SDK v.5 (Android)

Use this guide to add Vungle Android SDK into your app, using MoPub as your main advertising mediation layer.

Contents

Before You Begin

Step 1. Set Up Vungle as a Custom Native Network

To ensure that the MoPub servers recognize the integrated Vungle Adapters, set up Vungle as a Custom Native Network in the MoPub dashboard. 

  1. Log into the MoPub dashboard, and select Networks​ from the main navigation bar.

  2. Click Add a Network​….

    image4.png

    and select Custom Native Network​ at the bottom of the page.

    image1.png
  1. In the Set Up Your Inventory section, for each ad unit that will use the Vungle SDK to present video ads, ensure that the MoPub SDK can find the network adapter used to interact with the Vungle SDK:

    image2.png

    • If you are using MoPub Rewarded Video​ for an Ad Unit, add com.mopub.mobileads.VungleRewardedVideo under the Custom Event Class​ section.

    • If you are using Fullscreen (Interstitial)​ for an Ad Unit, add com.mopub.mobileads.VungleInterstitial under the Custom Event Class​ section.

    • Add your Vungle App ID​, placement Reference ID​, and all placement Reference IDs​ in JSON format under the Custom Event Class Data​.

    • Set the placement Reference ID you want to link to the MoPub Ad Unit for pid​.
      Note: A default placement is created for each app automatically. You must provide its placement reference ID in this initialization step whether or not you plan to take advantage of the placements functionality. If you create multiple placements, provide all the reference IDs.

    • Make sure to link the placement Reference ID set to “Rewarded” to the MoPub Ad Unit that is set to Rewarded Video​; and link the placement Reference ID that is NOT set to “Rewarded” to the MoPub Ad Unit that is set to Fullscreen (Interstitial)​.
      {
      "appId":"5935efecc802d63d5100000f",
      "pid":"DEFAULT05223",
      "pids":"DEFAULT05223, PADUNIT49379, PADUNIT68848, PADUNIT04241, PADUNIT53279, PADUNIT08448"
      }

Note:​ The Vungle SDK will cache an ad automatically for the placement you selected to be Auto Cached​ in the Vungle Dashboard. We highly recommend selecting the MoPub Ad Unit shown first or the Ad Unit shown most frequently as the Auto Cached​ placement.

Step 2. Add Vungle as a Third-Party Ad Network

To add the Vungle Android SDK into your app using MoPub mediation:

  1. Add all the Vungle-related adapter files (under /extras/src/com/mopub/mobileads/ in the MoPub Adapter Repository) to the /src/main/java/com/mopub/mobileads/ directory in your app’s project. This step is necessary because the MoPub SDK references these files as “Custom Event Class properties” in the directory.

    • VungleInterstitial.java
    • VungleRewardedVideo.java

  2. Follow the instructions in the “Step 1. Include the Vungle SDK in Your Project“ section of “Get Started with Vungle - Android SDK“ to add the necessary frameworks.

  3. If you need to set Multidex , Proguard and Google Play Services, follow the instructions in the “Advanced Settings“ section of “Get Started with Vungle - Android SDK“ to update AndroidManifest.xml in your project.

  4. Call the MoPubInterstitial’s show method (or, for rewarded ads, call the MoPubRewardedVideos's showRewardedVideo method) when you want to present a Vungle video ad. (No need to call the Vungle Android SDK methods directly. The MoPub SDK will do it.)
Have more questions? Submit a request

Comments