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 Exchange SDK

Updated 6 days ago ​by Derek Lim

Overview

This tutorial helps you install the Exchange SDK in your Android app.

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 v11.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.

Install Exchange SDK

Please note that if you are an existing Avocarrot publisher and migrating from Avocarrot SDK v3.x to Avocarrot v4.x you should consult our migration guide here.
Please note that if you are an existing Avocarrot publisher and migrating from Avocarrot SDK v4.0 to Avocarrot v4.x you should consult our migration guide here.

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

  1. Add the following rows in your app module build.gradle file:
     
    repositories {
        maven { url "https://s3.amazonaws.com/avocarrot-android-builds/dist/" }
    }
  2. Add the SDK to your app
     
    dependencies {
      ...
      compile 'com.avocarrot.sdk:mediation-sdk-nativead:4.5.0'
      compile 'com.google.android.gms:play-services-ads:11.0.4'
    }

    You can also find the latest jar and changes of the SDK in the Android SDK Changelog.

  3. Update AndroidManifest.xml
     
    <?xml version="1.0" encoding="utf-8"?>
    <manifest ... >
       <!-- Required -->
       <uses-permission android:name="android.permission.INTERNET" />
       <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
       <!-- Optional -->
       <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
       <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
       <application ...>
          <activity> ... </activity>
          <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
       </application>
    </manifest>
  1. 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'
      }
    }
    
  2. Add the SDK to your app

    dependencies {
        compile(name: 'mediation-sdk-nativead', version:'4.5.0', ext: 'aar')
        compile 'com.google.android.gms:play-services-ads:10.2.6'
    }
    
  3. Then add following rows in your app module proguard-rules.pro file:

    -keep class com.avocarrot.** { *; }
    -dontwarn com.avocarrot.**     
    
  4. Update AndroidManifest.xml

    <?xml version="1.0" encoding="utf-8"?>
    <manifest ... >
       <!-- Required -->
       <uses-permission android:name="android.permission.INTERNET" />
       <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
       <!-- Optional -->
       <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
       <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
       <application ...>
          <activity> ... </activity>
          <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
       </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 Exchange offers a number of native ad formats, so you can choose the one that best fits your app's user experience.


Was this article useful?