Skip to content
Asaf Gaber edited this page Nov 15, 2016 · 76 revisions

Adapters enable you to use the MobFox SDK inside other ad networks SDK's that you are using. This way you can display MobFox ads in addition to ads from other host networks.

MoPub

  1. Install the MobFox Android SDK Core.
  2. Install the MoPub Android SDK.
  3. Download the MobFox-Android-MoPub-Adapter.jar and Place it in your application's libs folder (next to your src folder).
  4. Add MobFox-Android-MoPub-Adapter.jar as a dependency in your gradle.build file.
  5. See the docs in MoPub for creating and integrating Banner / Interstitial ads.
  6. Create a MobFox publication.
  7. See the docs in MoPub for implementing custom networks on the MoPub ads previously created.
  8. For banner ads use this CUSTOM EVENT CLASS com.mobfox.sdk.adapters.MoPubBannerAdapter and in CUSTOM EVENT CLASS DATA input: {"invh":"<your-publication-hash>"} Use your required MobFox's publication hash.
  9. For interstitial (fullscreen) ads use this CUSTOM EVENT CLASS com.mobfox.sdk.adapters.MoPubInterstitialAdapter and in CUSTOM EVENT CLASS DATA input: {"invh":"<your-publication-hash>"} Use your required MobFox's publication hash. MoPub Set up Custom Native Network
  10. Now, when calling your MoPub ads, you should get the respective MobFox ads.
  11. Extra data can be passed to MobFox using the MoPub's localExtras object. "gender", "age" and "location" are supported at the moment. In your MoPub integration code create a new HashMap, and put the extra data in it (e.g. "gender"):
// ...
Map<String, Object> localExtras = new HashMap<>();
localExtras.put("gender", gender);
// ...
  • location:
    • key: "location"
    • format: Location (java class)
  • gender:
    • key: "gender"
    • format: String
    • value: "m|f"
  • age:
    • key: "age"
    • format: Integer

After putting all the data needed in the localExtras HashMap, pass it to the moPubView object:

// ...
moPubView.setLocalExtras(localExtras);
// ...

The data will be appended to your MobFox request.

#AdMob

  1. Install the MobFox Android SDK Core.
  2. Install the AdMob Android SDK.
  3. Place the MobFox-Android-AdMob-Adapter.jar in your application's libs folder (next to your src folder) and add it as a dependency in your gradle.build file.
  4. In your AdMob control panel:
  • Click the Monetize tab.
  • Under All Apps select your app.
  • On the relevant Ad Unit, click the ad sources link.
  • Click the + New ad network button.
  • Select the MobFox network from the available ad networks list.
  • Fill in:
    • Publisher Site ID - your MobFox publication hash.

AdMob Set up Custom Native Network

#Smaato

  1. Install the MobFox Android SDK Core.
  2. Install the Smaato Android SDK.
  3. Place the MobFox-Android-Smaato-Adapter.jar in your application's libs folder (next to your src folder) and add it as a dependency in your gradle.build file.
  4. In your Smaato console:
  • In the networks tab, select custom sdk network and NOT MobFox network (deprecated). Smaato wiki.
  • Under All Apps select your app.
  • On the relevant Ad Unit, click the ad sources link.
  • Click the + New ad network button.
  • Select the MobFox network from the available ad networks list.
  • Fill in:
    • Publisher Site ID - your MobFox publication hash.

#DFP DFP uses the same adapter as AdMob.

  1. Install the MobFox Android SDK Core.
  2. Install the DFP Android SDK.
  3. Place the MobFox-Android-AdMob-Adapter.jar in your application's libs folder (next to your src folder) and add it as a dependency in your gradle.build file.
  4. In your DFP creative select the MobFox network and put in your MobFox publication hash.

DFP Set up Custom Native Network More DFP custom event documentation can be found here: https://developers.google.com/mobile-ads-sdk/docs/dfp/android/custom-events.

Clone this wiki locally