MoPub

This Guideline will instruct you step-by-step on how to set Vungle live as an ad network on the AdTiming Mediation platform.

Before You Start

Make sure you have correctly integrated AdTiming's Native, Interstitial Ads in your application.

Important!We HAVE UPDATED AdTiming SDK to 6.0.  With the Android SDK Version 5.5.0 and above, you need to download Not Only the SDK of mediation networks you choose to work with But Also the adapters for those ad networks. Be sure to follow this Guide to mediation MoPub's Ads.

Step 1. Create a MoPub Account

To access MoPub's ad inventory through AdTiming’s Mediation platform, you must create an account with MoPub.

Please Note: If you don’t have either of these accounts, you can create them during the sign-up process and connect them to your account.

Step 2. Create an App and Ad Unit in MoPub

Next, you must add your app and set up Ad Unit in your MoPub account.

1. Add Your App

  • Log into your MoPub account. On your dashboard, click the 'New App' button.mceclip0.png

 

  • Add your app manually to monetize.mceclip1.png
  • If your app is on the Kindle App Store or it’s unpublished, click on 'My app is on the Kindle App Store or it’s unpublished' and you will be directed to the page of creating new app.mceclip6.png

2. Add Ad Units

  • Select a specific app and click on 'New ad unit'. 
    mceclip3.png

 

  • Select Interstitial, Native or Banners as your ad unit format and enter the relevant details. mceclip9.png
  • When you finish creating the ad unit, you will see the Popup with the 'Code integration' and the Ad unit ID was presented on it.  Read Android native ad integration▶ for more information about MoPub Ads Integration for Android SDK. 
    mceclip10.png

Please Note: You will need a unique MoPub application per platform (iOS + Android).

Step 3. Retrieve MoPub Parameters

Serving MoPub’s ads through the AdTiming Mediation platform is easy to operate. Sign in to your account when setting up MoPub Ad Network in AdTiming 'Mediation Setting' module and we’ll retrieve all the necessary parameters to run MoPub’s Interstitial, Banner and Native ads for you.

1. API Key

From the 'Reports' page, check on 'Enable data access through API' -> click on the 'View API Access Details' link to retrievel your API Key.mceclip11.png

2. MoPub Inventory Report ID

Click the 'View API Access Details' link to retrieve your Inventory Report ID.

mceclip12.png

3. MoPub Ad Unit ID

  • To retrieve MoPub Ad Unit ID, just click on your app -> Click on 'Edit ad unit' -> Select 'View code integration' mceclip13.png
  • You will see the Popup with the 'Code integration' above mentioned in Step 2. mceclip10.png

Once you obtain the parameters of MoPub above mentioned, you're supposed to configure MoPub’s Parameters in your AdTiming Account. By adding the above information correctly, you will be able to take full advantage of MoPub’s ad inventory and reporting data on the AdTiming Mediation platform.

Step 4. Configure MoPub's Parameters into AdTiming Account

1. Once you have both of these parameters, log in to your AdTiming account and go to Placement ->Edit your placement  

2. Click on Instances-> Add Instance. Select Mopub from the list of Available Ad Networks, click 'New Account'

___35.jpg

3. Complete the following parameters below,and click 'Save'.  ___36.jpg

Step 5. Add the MoPub SDK&Adapter to Your Build

Android

1. Add the MoPub SDK

  • Add to your project-level build.gradle file.
 ...
 allprojects {
   repositories {
       ...

       jcenter()
       maven {
           url "https://s3.amazonaws.com/moat-sdk-builds"
       }
    }
 }
  • Add to your application-level build.gradle file.
android {
    defaultConfig {
        minSdkVersion 19
    }
}

dependencies {
    ...
    implementation ('com.mopub:mopub-sdk:5.12.0@aar') {transitive = true}
}

2. Add the MoPub Adapter

     AdTiming supports both Gradle dependencies and Manual download mechanisms.

       Gradle dependencies

  • Add the following in your project-level build.gradle file.
 ...
allprojects {
repositories {
...
jcenter()
maven {
url "https://dl.adtiming.com/android-sdk"
}
}
}
  • Add the following in your application-level build.gradle file.
 implementation 'com.adtiming.adapters:mopub:3.5.0@aar'

       Manual download

  • Download the MoPub Adapter from here.
  • Add the MoPub Adapter to Your Project
    Move the MoPubAdapter-x.x.x.aar to the libs folder in your Android Project.
  • Make sure you add the following to your Gradle build file under the dependencies section:
implementation (name:'MoPubAdapter-x.x.x', ext:'aar')

3. Update AndroidManifest.xml

  • Configure Android Manifest.xml to add permissions.
 <!-- Required permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Optional permissions. Will pass Lat/Lon values when available. Choose either Coarse or Fine -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Optional permissions. Used for MRAID 2.0 storePicture ads -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  • Configure Android Manifest.xml to add activities.
<activity
android:name="com.mopub.common.MoPubBrowser"
android:configChanges="keyboardHidden|orientation|screenSize" />
<!-- Interstitials -->
<activity
android:name="com.mopub.mobileads.MoPubActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name="com.mopub.mobileads.MraidActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<!-- Rewarded Video and Rewarded Playables -->
<activity android:name="com.mopub.common.privacy.ConsentDialogActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.RewardedMraidActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>

4. For Proguard Users Only
If you are using ProGuard with the MoPub adapter, you must add the following code to your ProGuard configuration (Android Studio: proguard-rules.pro or Eclipse: proguard-project.txt):

 # Keep public classes and methods.
 -keepclassmembers class com.mopub.** { public *; }
 -keep public class com.mopub.**
 -keep public class android.webkit.JavascriptInterface {}
 # Explicitly keep any custom event classes in any package.
 -keep class * extends com.mopub.mobileads.CustomEventBanner {}
 -keep class * extends com.mopub.mobileads.CustomEventInterstitial {}
 -keep class * extends com.mopub.nativeads.CustomEventNative {}
 -keep class * extends com.mopub.nativeads.CustomEventRewardedAd {}
 # Keep methods that are accessed via reflection
 -keepclassmembers class ** { @com.mopub.common.util.ReflectionTarget *; }
 # Support for Android Advertiser ID.
 -keep class com.google.android.gms.common.GooglePlayServicesUtil {*;}
 -keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {*;}
 -keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {*;}
 # Support for Google Play Services
 # http://developer.android.com/google/play-services/setup.html
 -keep class * extends java.util.ListResourceBundle {
   protected Object[][] getContents();
 }
 -keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
   public static final *** NULL;
 }
 -keepnames @com.google.android.gms.common.annotation.KeepName class *
 -keepclassmembernames class * {
   @com.google.android.gms.common.annotation.KeepName *;
 }
 -keepnames class * implements android.os.Parcelable {
   public static final ** CREATOR;
}

 

iOS

AdTiming supports both Cocoapods and Manualdownload mechanisms.

Cocoapods

To Integrate the MoPub SDK with Cocoapods, enter the following line in your podfile and you are good to go!

pod 'mopub-ios-sdk'
Copy

Manual Download

1. Download the Mopub framework

  • you can find the lastest Mopub SDK here.

2. Add the MoPub frameworks to your Project

Done!
You are now all set to deliver MoPub Ads within your application.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.