Get Started with Avocarrot

Overview

Examples

Android

Overview

- Avocarrot Exchange SDK

Setup Exchange SDK

Stream

Native Assets

Exchange Troubleshooting

- Avocarrot Mediation SDK

Setup Mediation

Stream Ads Mediation

Native ads Mediation

Native Assets Mediation

Banner Mediation

Interstitial Mediation

Video Mediation

Supported Networks & Ad Types

Mediation Troubleshooting

iOS

Overview

- Avocarrot Exchange SDK

Setup SDK

Stream

Native Assets

Exchange Troubleshooting

- Avocarrot Mediation

Getting Started With Mediation

Stream Ads Mediation

Native Ads Mediation

Banner Ads Mediation

Interstitial Ads Mediation

Video Ads Mediation

Supported Networks & Ad Types

Mediation Troubleshooting

API Documentation

Reporting API

Help

FAQ

Updates

SDK Change Log

Android Change Log

iOS Change Log

Setup Mediation

Updated 6 days ago ​by Derek Lim

Overview

This tutorial helps you install the Mediation SDK and start serving ads to your Android apps from third-party ad networks including the Avocarrot exchange.

You need an Avocarrot account to complete the tutorial. Create an account

Requirements and Dependencies

  • Android 2.3 (API Version 9) and up
  • support-annotations, v25.4.0
  • support-v4, v25.4.0
  • Recommended Google Play Services 11.0.4

We strongly recommend compiling your app using Google Play services, in order to use the Android Advertising IDinstead of the Device ID, as required by Google. Failing to correctly use the Android Advertising ID may result in your submission to the Play Store being rejected.

You must have a different adUnitId for every ad space placement in your app. If you use the same ID for multiple placements or the IDs from the testing/demo examples, reporting errors will occur and there will be no payout. Please ask your account manager for further details.

Install Mediation SDK

 Add the Avocarrot Mediation SDK and 3rd-party Networks to your Project. 

You should add only the 3rd party ad networks that you already use or plan to use them in your mediation waterfall. You can have a look on the supported ad networks and their ad types here.  

The Mediation SDK is available via:
1. jCenter AAR (Recommended)
2. Zipped AAR

Add the following rows in your app module build.gradle file:
repositories {
    maven { url "https://s3.amazonaws.com/avocarrot-android-builds/dist/" } 
}
 
dependencies {
  compile 'com.avocarrot.sdk:mediation-sdk-banner:4.5.0'
  compile 'com.avocarrot.sdk:mediation-sdk-interstitial:4.5.0'
  compile 'com.avocarrot.sdk:mediation-sdk-video:4.5.0'
  compile 'com.avocarrot.sdk:mediation-sdk-nativead:4.5.0'
  //3rd party SDKs if you need. Don't need to corresponding mediation-sdk module
  compile 'com.avocarrot.sdk:mediation-admob-banner:4.5.0'
  compile 'com.avocarrot.sdk:mediation-admob-interstitial:4.5.0'
  compile 'com.avocarrot.sdk:mediation-admob-nativead:4.5.0'
  compile 'com.avocarrot.sdk:mediation-applovin-interstitial:4.5.0'
  compile 'com.avocarrot.sdk:mediation-applovin-nativead:4.5.0'
  compile 'com.avocarrot.sdk:mediation-chartboost-interstitial:4.5.0'
  compile 'com.avocarrot.sdk:mediation-facebook-banner:4.5.0'
  compile 'com.avocarrot.sdk:mediation-facebook-interstitial:4.5.0'
  compile 'com.avocarrot.sdk:mediation-facebook-nativead:4.5.0'
  compile 'com.avocarrot.sdk:mediation-inlocomedia-banner:4.5.0'
  compile 'com.avocarrot.sdk:mediation-inlocomedia-interstitial:4.5.0'
  compile 'com.avocarrot.sdk:mediation-inlocomedia-nativead:4.5.0'
  compile 'com.avocarrot.sdk:mediation-mopub-banner:4.5.0'
  compile 'com.avocarrot.sdk:mediation-mopub-interstitial:4.5.0'
  compile 'com.avocarrot.sdk:mediation-mopub-nativead:4.5.0'
  compile 'com.avocarrot.sdk:mediation-nativex-interstitial:4.5.0'
  compile 'com.avocarrot.sdk:mediation-nativex-video:4.5.0'
  compile 'com.avocarrot.sdk:mediation-unityads-video:4.5.0'
  compile 'com.avocarrot.sdk:mediation-vungle-video:4.5.0'
  compile 'com.google.android.gms:play-services-ads:11.0.4'
}
Include the Local .aar Libraries
You can find local aar files in our sample project under libraries here
Save the aar files under app module’s libs folder (eg: <project>/<app>/libs) Then add the following rows in your app module build.gradle file:
repositories {
  flatDir {
    dirs 'libs'
  }
}
dependencies {
  compile(name: 'mediation-sdk-banner', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-sdk-interstitial', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-sdk-video', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-sdk-nativead', version:'4.5.0', ext: 'aar')
  //3rd party SDKs if you need. Don't need to corresponding mediation-sdk module
  compile(name: 'mediation-admob-banner', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-admob-interstitial', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-admob-nativead', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-applovin-interstitial', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-applovin-nativead', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-chartboost-interstitial', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-facebook-banner', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-facebook-interstitial', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-facebook-nativead', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-inlocomedia-banner', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-inlocomedia-interstitial', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-inlocomedia-nativead', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-mopub-banner', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-mopub-interstitial', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-mopub-nativead', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-nativex-inerstitial', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-nativex-video', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-unityads-video', version:'4.5.0', ext: 'aar')
  compile(name: 'mediation-vungle-video', version:'4.5.0', ext: 'aar')
  compile 'com.google.android.gms:play-services-ads:11.0.4'
  compile 'com.facebook.android:audience-network-sdk:4.25.0'
  compile('com.mopub:mopub-sdk-banner:4.15.0@aar') {
    transitive = true
  }
  compile('com.mopub:mopub-sdk-interstitial:4.15.0@aar') {
      transitive = true
  }
  compile('com.mopub:mopub-sdk-native-static:4.15.0@aar') {
        transitive = true
  }
  compile 'com.inlocomedia.android:android-sdk:3.0.7'
}

Then add following rows in your app module proguard-rules.pro file:

-keep class com.avocarrot.** { *; }
-dontwarn com.avocarrot.**

Modify your Android Manifest 

Under the main <manifest> element, add the following permissions.

<!--?xml version="1.0" encoding="utf-8"?-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.avocarrot.demo">
    <!-- Recommended -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> 
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <!-- Optional -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 
    <application ...="">
        ...
    </application>
</manifest>
  • ACCESS_COARSE_LOCATION (recommended) – Grants the SDK permission to access approximate location based on cell tower.
  • ACCESS_FINE_LOCATION (recommended) – Grants the SDK permission to access a more accurate location based on GPS.
    Although not technically required, the LOCATION permissions make it possible for the SDK to send location-based data to advertisers. Sending better location data generally leads to better monetization.
  • WRITE_EXTERNAL_STORAGE (optional) – Allows the SDK to cache all ad assets (creatives, custom frames, etc.) in external memory. This can maximize performance by ensuring immediate delivery of ads and minimize network traffic used by the SDK by keeping cached ad assets available even after the user closes the app.
  • READ_PHONE_STATE (recommended) – Allows the SDK to handle calls interrupting video playback during videos.
If you’re already integrated with a demand buyer,  It is not mandatory to remove all SDKs, but we would recommend it in order to ensure a seamless and coherent integration with Avocarrot.
 When using SDK as a library project, you shouldn’t need to worry about merging AndroidManifest.xml changes or Proguard settings. If you run into problems, make sure manifestmerger.enabled is set to true in project.properties Please see the Android documentation here.

Next Steps

Choose an ad format

You're ready to implement an ad. Avocarrot mediation offers a number of ad formats, so you can choose the one that best fits your app's user experience.


Was this article useful?