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

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

Contents

A few notes before you begin

  • You need to have MoPub set up in your app before following this guide. Refer to MoPub’s Getting Started Guide for Android for instructions.

  • We use MoPub’s pre-built adapters in this tutorial, which are available in the MoPub SDK on GitHub.

  • Once you have Vungle integrated, you will be presenting your ads through MoPub’s InterstitialAdController. Refer to MoPub’s Interstitial Guide for Android for details on how to use this controller.

  • If you haven't already done so, head over to our dashboard and add your app to your account. You need to do this so that you can get your App ID, which you’ll be adding to your app with our SDK. It’s in red on your app’s page.

Now let's get started. Only two general steps will have you up and running.

1. Set Up Vungle as a Custom Native Network

To enable the MoPub servers to recognize your integrated Vungle Adapters, set up Vungle as a Custom Native Network in the MoPub dashboard. This is easy:

  1. While logged into the MoPub dashboard, navigate to Networks in the main navigation bar.

  2. Click Add a Network and select Custom Native Network at the bottom of the page.

  3. In the Set Up Your Inventory section, follow these steps for each Ad Unit that will be using the Vungle SDK to present video ads:

    1. Ensure that the MoPub SDK can find the network adapter you used earlier to interact with the Vungle SDK:

      - If you are using reward ads, add com.mopub.mobileads.VungleRewardedVideo as a Custom Event Class.

      - If you are using interstitial ads, add com.mopub.mobileads.VungleInterstitial as a Custom Event Class.

    2. Add your Vungle App ID in JSON format under Custom Event Class Data (for example, 
      { “appId” : “Test_Android” }
      replacing Test_Android with your own App ID, found on the Vungle Dashboard of your app.)

2. Add Vungle as a Third-Party Ad Network

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

  1. From the MoPub SDK /extras/src/com/mopub/mobileads/ directory, add the following two files 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. Download the Vungle Android SDK 4.1.0 and copy the following library files into the /libs/ folder in your project:

    - dagger-[version].jar
    - javax.inject-[version].jar
    - vungle-publisher-adaptive-id-[version].jar
    - eventbus-[version].jar
    - rxjava-[version].jar


    Make sure your project has links to those libraries in Project Files > Structure > Dependencies (Choose your project in Modules).

  3. Follow the instructions in the Update AndroidManifest.xml section of the Get started with Vungle - Android SDK to update AndroidManifest.xml in your project.

  4. Refer to MoPub’s documents for how to display interstitial and rewarded ads. 

And that’s it! Vungle will now be rotated in through MoPub’s standard ad presentation waterfall. If you want to manually set eCPMs to control waterfall positions, you can do that under MoPub’s Segment Detail page on the MoPub dashboard. 

Please check out MoPub’s help center for more information on the MoPub + Vungle integration!

 

Have more questions? Submit a request

Comments