Class AdListener
java.lang.Object
com.codename1.ads.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 AbstractFullScreenAd.isLoaded() in a loop.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInvoked when the user clicked the ad.voidInvoked when the full screen ad was dismissed and the app regained focus.voidonFailedToLoad(AdError error) Invoked when the ad failed to load.voidInvoked when an impression was recorded for the ad.voidonLoaded()Invoked when the ad finished loading and is ready to be shown.voidonShowFailed(AdError error) Invoked when the ad failed to present.voidonShown()Invoked when the ad was presented full screen (or rendered, for banners).
-
Constructor Details
-
AdListener
public AdListener()
-
-
Method Details
-
onLoaded
public void onLoaded()Invoked when the ad finished loading and is ready to be shown. -
onFailedToLoad
Invoked when the ad failed to load.
Parameters
error: the failure description
-
onShown
public void onShown()Invoked when the ad was presented full screen (or rendered, for banners). -
onShowFailed
Invoked when the ad failed to present.
Parameters
error: 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.
-