public class AdListener

  1. Object
  2. AdListener

Receives the lifecycle events of an ad. This is an adapter class with empty implementations so you only override the events you care about:

interstitial.setAdListener(new AdListener() {
    public void onDismissed() {
        // resume gameplay
    }
});

Every callback is delivered on the Codename One EDT, so it is safe to touch the UI directly. The model is fully event driven; there is never a need to poll InterstitialAd.isLoaded() in a loop.

Constructors

public AdListener()

Methods

public void onLoaded()Invoked when the ad finished loading and is ready to be shown.
public void onFailedToLoad(AdError error)Invoked when the ad failed to load.
public void onShown()Invoked when the ad was presented full screen (or rendered, for banners).
public void onShowFailed(AdError error)Invoked when the ad failed to present.
public void onDismissed()Invoked when the full screen ad was dismissed and the app regained focus.
public void onImpression()Invoked when an impression was recorded for the ad.
public void onClicked()Invoked when the user clicked the ad.

Inherited methods

Constructor details

AdListener

public AdListener()

Method details

onLoaded

public void onLoaded()
Invoked when the ad finished loading and is ready to be shown.

onFailedToLoad

public void onFailedToLoad(AdError error)
Invoked when the ad failed to load.

Parameters

error AdError
the failure description

onShown

public void onShown()
Invoked when the ad was presented full screen (or rendered, for banners).

onShowFailed

public void onShowFailed(AdError error)
Invoked when the ad failed to present.

Parameters

error AdError
the failure description

onDismissed

public void onDismissed()
Invoked when the full screen ad was dismissed and the app regained focus. This is the right place to load the next ad and resume the app.

onImpression

public void onImpression()
Invoked when an impression was recorded for the ad.

onClicked

public void onClicked()
Invoked when the user clicked the ad.