Integrating Native Third-Party Ad Networks – Android
Updated September 2016
The MoPub SDK can mediate any native ad network SDK through our custom events capabilities. As a developer, this allows you to serve ads from multiple networks through our NativeResponse class. In order to mediate third party native ads, you must have already MoPub Native Ads.
We offer a ‘plug-and-play’ native ad integration for [Facebook Audience Network]
To set up native integration for a different network, see our list of Supported Networks.
Native Third-Party Integration Guide
1. Setup a Third-Party Network in your MoPub Account
Facebook Audience Network Native Ads should be set up as custom native networks in your MoPub account.
2. Add the custom event files to your project
Integrating using the SDK AAR
Integrating using the AAR, the folder for ‘nativeads’ will not exist in your project files. Add the folder ‘nativeads’ into `com.mopub` under your app’s `src/` directory and copy the adapters from [extras/com/mopub/nativeads] that you want to include into the folder.
Integrating using the SDK Source
The [extras/com/mopub/nativeads] folder contains a set of custom events; simply copy the ones you want into `com.mopub.nativeads` into your app’s `src/` directory.
If you don’t the extras folders in your SDK, you will need to clone the MoPub SDK repo:
- `git clone https://github.com/mopub/mopub-android-sdk.git`
- Currently, our SDK supports the following third-party ad network:
- Facebook Audience Network(`FacebookNative.java`)
3. Link the third-party SDKs
Incorporate the third-party SDKs into your project. This typically involves copying a .jar file to your `libs/` directory and adding an entry to your build path. Specific instructions can be found by visiting the ad networks’ developer pages. The relevant JARs are as follows:
Facebook Audience Network (`AudienceNetwork.jar`)
4. Display native ads as usual
No changes are required to any of the other code! Be sure to setup corresponding network campaigns and target the proper ad units in your MoPub account.