Get Started with Avocarrot

Overview

Examples

Android

Overview

Getting Started

- Integrating Ads

Stream

Native Assets

Banner

Interstitial

Video

- Others

Supported Networks & Ad Types

Troubleshooting

- Adapters

Admob Android Adapter

Mopub Android Adapter

iOS

Overview

Getting Started

- Integrating Ads

Stream

Native Assets

Banner

Interstitial

Video

- Others

Supported Networks & Ad Types

Troubleshooting

- Adapters

Admob iOS Adapter

Mopub iOS Adapter

API Documentation

Reporting API

Help

FAQ

Updates

SDK Change Log

Android Change Log

iOS Change Log

Mopub Android Adapter

Updated 20 days ago ​by Derek Lim

This is an adapter to be used in conjunction with the MoPub Android SDK.

Requirements

  • MoPub Android SDK v4.15.0 or later.
  • Avocarrot Android SDK v4.5.1 or later.

Integrating Avocarrot Android SDK

  1. Add Avocarrot Repository to yourbuild.gradlefile:
    repositories {
      maven { url  "https://s3.amazonaws.com/avocarrot-android-builds/dist" }
    }
  2. Add the compile dependency with the latest version of the Avocarrot adapter
    dependencies {
        // Banner
        compile 'com.avocarrot.sdk:adapter-mopub-banner:1.4.0'
        // Interstitial
        compile 'com.avocarrot.sdk:adapter-mopub-interstitial:1.4.0'
        // Native
        compile 'com.avocarrot.sdk:adapter-mopub-nativead:1.4.0'
    }
    Only add the dependencies according to the ad format you need
  3. The Avocarrot SDK should be initialised and started before requiring for ads. To ensure that the metrics are not over-counted, it is highly recommended that the Avocarrot SDK be called in the Application class.

    public class YourApplication extends Application {
        @Override
        public void onCreate() {
            super.onCreate();
            Avocarrot.onApplicationCreated(this);
            //...
        }
        //...
    }
  4. Add application name to your AndroidManifest.xml file.

    <application android:name=".YourApplication">
      <!-- activities goes here -->
    </application>

Setup MoPub Dashboard

Create an "Avocarrot" Network in MoPub's dashboard and connect it to your Ad Units.

  1. In MoPub's dashboard select Networks > Add New network
  2. Then select Custom Native Network
  3. For Native Ad Units you need complete the following:
  4. Under Custom Event Class add the appropriate class according to ad format you are using:

    // For Banner
    com.mopub.mobileads.AvocarrotBanner
    // For Interstitial
    com.mopub.mobileads.AvocarrotInterstitial
    // For Native
    com.mopub.nativeads.AvocarrotNativeMopub
  5. Under Custom Event Class Data add your ad unit id:

    {"adUnit":"<avocarrotadunit>"} or {"adUnitId":"<avocarrotadunit>"}
    Get your ad unit if from Avocarrot dashboard

Was this article useful?