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

Interstitial Mediation

Updated 7 days ago ​by Derek Lim

Overview

This tutorial helps you setup interstitial ads mediation.

Prerequisites

You need an Avocarrot account to complete the tutorial. Create an account
You need to setup the Mediation SDK. Setup Mediation SDK

Setup Interstitial Mediation

All SDK method calls should be done from the main thread (Main thread, UI thread).

ID of advertising space for testing : "6b34bf0e-04c4-47f9-b4d3-caeddeab0b13"

The ID above is meant for testing purpose only, please replace it with the Ad unit Id of your placement on dashboard.
  1. Add the following code to your activity:


    InterstitialAd interstitialAd =InterstitialAdPool.load(this, "YOUR_INTERSTITIAL_AD_UNIT_ID", interstitialAdListener);
    interstitialAd.loadAd();

    After calling the loadAd() method, the interstitial download starts. If you call loadAd()again before the banner is fully served, the previous request processing is cancelled. In this case, only the last request will be processed.

    When the banner download is completed, you can display the banner by calling showAd()method.


    interstitialAd.showAd();
    To learn about download completion, subscribe to banner events (see Ad Events Handling) or call method isReady().


    interstitialAd.isReady();
    If your application workflow allows showing full screen banners at any time and in any place, there are 2 additional ways to show it right after the loading has finished or with a custom delay after method invocation.

    To load and show full screen banner right after it was loaded use:


    InterstitialAdPool.loadAndShow(this, "YOUR_INTERSTITIAL_AD_UNIT_ID", interstitialAdListener);



    To load and show full screen banner with a custom delay after method invocation use:

    InterstitialAdPool.loadAndShowWithDelay(this, "YOUR_INTERSTITIAL_AD_UNIT_ID", interstitialAdListener);

    The delay interval is specified via Admin UI interface.

    If you need to reload Interstitial manually, call

    interstitialAd.reloadAd();

    or

    interstitialAd.reloadAndShowAd();

    or

    interstitialAd.reloadAndShowAdWithDelay();

    If you want full control over when and where to show full screen banners, use the following steps:

    a. Set InterstitialAdCallback to handle interstitial events

    b. Call InterstitialAdPool.loadAd() in advance

    c. When you want to show the banner, check that it is ready and show: if (interstitialAd.isReady()) interstitialAd.showAd()

    d. Start loading next banner in onAdClosed() event handler of InterstitialAdCallback


    Activity lifecycle events handling

    onPause()onResume() and onDestroy() methods should be called depending on the activity lifecycle events.

    Example:
    @Override
    protected void onPause() {
        super.onPause();
        interstitialAd.onActivityPaused();
    }
    @Override
    protected void onResume() {
        super.onResume();
        interstitialAd.onActivityResumed();
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        interstitialAd.onActivityDestroyed();
    }
  2. Congratulations! Compile and Run your project. You can now further customize your interstitial ads.

Advanced Customization

Go Live!

  1. Remove sandbox If you have received a sample ad then simply disable the Sandbox mode by including the following instruction in your code:
    AvocarrotSDK.setTestMode(false);
    You should disable Sandbox mode ONLY when you are done with the integration and you are ready to publish your app. It is against Avocarrot's policies to use live ads during development, and doing so could get your Avocarrot account banned.
  2. Publish app You are now ready to upload your app and start making money! If you have submitted your app in the Google Play/ Apple Store and you can see live ads, then you have nothing to worry about. Just wait until the impressions threshold has been reached and the app will be shown as live in your dashboard as well.
  3. Update payment details. Login to your account and update your payment settings.



Was this article useful?