Interstitial Ads

Interstitial Ads are loaded automatically. You can observe ad loading events by specifying the delegate:

Interstitial interstitial = new Interstitial(this);
interstitial.setLoadDelegate(this);

The delegate should implement the following methods:

@Override
public void didLoad(AdInfo adInfo) {
    print("Interstitial - didLoadAd. AdInfo: " + adInfo) 
}

@Override
public void didFailToLoad(AdInfo adInfo, Error error) {
    print("Interstitial - didFailToLoadAd. AdInfo:" + adInfo + " Error: " + error.getLocalizedMessage()) 
}

Showing an Interstitial Ad

To show an interstitial ad, call showWithDelegate instance method of the Interstitial class:

interstitial.showWithDelegate(Activity, showDelegate);

The delegate should implement the following methods:

@Override
public void didDisplayAd(AdInfo adInfo) {
    System.out.println ("Interstitial - didDisplayAd. AdInfo:" + adInfo) 
}

@Override
public void didClickAd(AdInfo adInfo) {
    System.out.println("Interstitial - didDisplayAd. AdInfo:" + adInfo );
}

@Override
public void didHideAd(AdInfo adInfo) {
    System.out.println("Interstitial - didHideAd. AdInfo:" + adInfo );
}

@Override
public void didFailToDisplayAd(AdInfo adInfo, Error error) {
    System.out.println("Interstitial - didFail toDisplayAd. AdInfo:" + adInfo + error.getLocalizedMessage());
}

@Override
public void allNetworksDidFailToDisplayAd() {
    System.out.println("Interstitial - allNetworksDidFailToDisplayAd.");
}

Stopping and Starting Auto-Load

By default, Interstitials preload ads before any load attempt. So an Interstitial can use already preloaded ads instead of waiting on a manual load call to load new ads. To disable this feature you need to call the following method:

interstitial.setAutoload(false);

Once you disable autoload, you should load ads manually every time you need them to show:

interstitial.load();

Last updated