Network Mediation Settings

Mediation settings enable you to pass in third-party network specific settings.

Prerequisite: Make sure to check out the Getting Started guide before continuing.

  1. For Android, make sure to drop the network’s SDK in the following path:
    • If the network SDK is a .jar file, add it in [UNITY PROJECT ROOT]/Assets/Plugins/Android/mopub-support/libs.
    • If the network SDK is an .aar file, add it in [UNITY PROJECT ROOT]/Assets/Plugins/Android.
  2. For iOS, add network SDK frameworks only after the project has been exported to Xcode.
  3. Review the MoPubDemoGUI.cs in the MoPub Unity sample app to pass ad unit IDs. This can be done similar to the below:

     private string[] _bannerAdUnits = new string[] {[YOUR_AD_UNIT_ID]};
     private string[] _interstitialAdUnits = new string[] {[YOUR_AD_UNIT_ID]};
     private string[] _rewardedVideoAdUnits = new string[] {[YOUR_AD_UNIT_ID]};
     private string[] _rewardedRichMediaAdUnits = new string[] {[YOUR_AD_UNIT_ID]};
    

Writing Custom Events for Unsupported Ad Networks

Android

  1. Follow this guide to author the custom event class for Android.
  2. Add the mediated network’s SDK to the right directory. Refer to the section above for the appropriate paths.
  3. Add the custom events (as .jar files) to [UNITY PROJECT ROOT]/Assets/Plugins/Android/mopub-support/libs. For ease of maintenance, we recommend keeping the custom event classes and the network SDKs as separate .jar files.

iOS

  1. Follow this guide to author the custom event class for iOS.
  2. Create a separate folder in [UNITY PROJECT ROOT]/Assets/Editor/MoPub/NativeCode and add the SDKs and custom event files directly.

Troubleshooting

  • For a complete example of how to add ads into your app, check out the MoPubDemoScene in Assets/Scenes/.
  • You can also test the MoPubDemoScene for both iOS and Android.
  • As of the Unity editor 5.0.2f1, occasionally the static libraries will not be added to the Build Phase settings correctly. If you encounter a build error about missing frameworks/libraries, remove and re-add them manually
  • For mediating AdColony through MoPub’s Unity wrappers, install the AdColony Unity Plugin to receive ads from the AdColony SDK. This has a special version of the Android AdColony SDK without native libraries for unsupported Unity architectures.
  • Concurrent ad requests using the same adunits or multiple adunits is not recommended until we make additional improvements.

Last updated October 10, 2018

TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.

© 2018 MoPub Inc.