Integrate with MoPub

If you already have MoPub ads serving in your app, but want to integrate AwesomeAds as well, without having to directly use the Android Publisher SDK, you can follow the steps below:

repositories {
    maven { url "https://aa-sdk.s3-eu-west-1.amazonaws.com/android_repo" }
}

Add the MoPub plugin

You can either change your module’s build.gradle file (usually the file under MyApplication/app/) to the following format:

dependencies {
    # add the Android Publisher SDK
    compile 'tv.superawesome.sdk.publisher:superawesome:RELEASE-VERSION-NAME'

    # add MoPub plugin
    compile 'tv.superawesome.sdk.publisher:samopub:RELEASE-VERSION-NAME'
}

Setup MoPub Custom Networks

Login to the MoPub dashboard using your preferred account.

From here forward the tutorial assumes you have an Android app with three ad units setup in MoPub; one banner, one interstitial ad and one rewarded video ad:

image-title-here

From your MoPub admin interface you should create a New Order

image-title-here

From the next menu, select New line item

image-title-here

Notice that the custom event class names required by MoPub are:

  • for Banner Ads:

tv.superawesome.plugins.publisher.mopub.AwesomeAdsMoPubBanner

  • for Interstitial Ads:

tv.superawesome.plugins.publisher.mopub.AwesomeAdsMoPubInterstitial

  • for Rewarded Video Ads:

tv.superawesome.plugins.publisher.mopub.AwesomeAdsMoPubVideo

And, you can tell MoPub what AwesomeAds ads to load and how to display them by filling out the custom event class data field with a JSON similar to this:

{
    "placementId": 30473,
    "isTestEnabled": true or false,
    "isParentalGateEnabled": true or false,
    "orientation": "ANY" or "PORTRAIT" or "LANDSCAPE",
    "shouldShowCloseButton": false or false,
    "shouldAutomaticallyCloseAtEnd": true or false,
    "shouldShowSmallClickButton": true or false
}
  • In the second tab Ad unit targeting, Select your App&ad unit e.g. Banner

  • In the third tab Audience targetting, Select your target audience

*Create multiple line items for banner, interstitial, and video(rewarded) ads.

Implement Ads

Initialise the MoPub sdk with AwesomeAds adapter configuration

MoPub.initializeSdk(this, SdkConfiguration.Builder("_any_ad_unit_id_")
                .withAdditionalNetwork("tv.superawesome.plugins.publisher.mopub.AwesomeAdsMoPubAdapterConfiguration")
                .build()) {
        }

Once the previous steps are done, you can add MoPub banners, interstitials and rewarded video ads just as you normally would:

Since the previously created custom events will run on these ads, and the Android Publisher SDK is integrated alongside the MoPub plugin, you should start seeing ads playing.