MoPub SDK adapter

Last updated on October 4, 2017

If you want to use OpenX as a source of demand on MoPub via the MoPub SDK, you can build an adapter to integrate the OpenX Mobile Android SDK with the MoPub SDK.

To help you quickly build your adapter, OpenX provides sample adapter code for bannerThis is an ad that appears on a web page which is typically hyperlinked to an advertiser’s website. Banners can be images (GIF, JPEG, PNG), JavaScript programs or multimedia objects (For example, Java). and interstitialA full-screen ad displayed in content transitions. For example, a video ad that loads between levels of a mobile game. ads in the MoPub adapter sample app. The sample adapters are built according to MoPub's instructions. You will need to customize the adapters to meet your needs.

  1. Add the MoPub SDK as a dependency:
    [build.gradle (Module: app)]
    dependencies {
    	compile('com.mopub:mopub-sdk:4.14.0@aar') {
    		transitive = true
  3. Copy and paste the adapter files from the "Mediation Adapters" folder in OpenX Mobile Android SDK zip file into your project. Place the files in this location:


  4. In the MoPub web interface, in an order, create a network line itemThe primary unit of execution for an order, which represents a specific inventory purchase and the required conditions for ad delivery. using the Custom Native Network type. Place the fully-qualified class name of your custom event (for example, com.mopub.mobileads.MopubBannerAdapter) in the Custom Class field.
  5. In the Data field, please follow the following format:
    	"AD_UNIT_ID": "[OPENX AD UNIT]", 

    For example:

    	"AD_UNIT_ID": "123456789", 
    	"AD_DOMAIN": ""
  6. Select the app and ad unitThe smallest inventory component that represents the space on a site where ads display. for the line item to target.
  7. If using both adapters (MopubBannerAdapter and MopubInterstitialAdapter), create a separate line item for each adapter.