Class InterstitialAd
java.lang.Object
com.codename1.ads.InterstitialAd
A full screen interstitial ad shown at natural break points such as between game levels or activities.
InterstitialAd ad = new InterstitialAd("ca-app-pub-xxx/yyy");
ad.setAdListener(new AdListener() {
public void onLoaded() { ad.show(); }
public void onDismissed() { ad.load(); } // preload the next one
});
ad.load();
All callbacks are delivered on the EDT. You can also let Codename One show an
interstitial automatically on screen transitions with
AdManager.bindInterstitialOnTransition(InterstitialAd, int).
-
Constructor Summary
ConstructorsConstructorDescriptionInterstitialAd(String adUnitId) Creates an interstitial for the given ad unit id. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Releases the resources held by this ad.The listener notified of this ad's lifecycle events, may be null.booleanisLoaded()True when an ad is loaded and ready toshow().voidload()Loads an ad with default targeting.voidLoads an ad using the supplied targeting metadata.voidsetAdListener(AdListener listener) Sets the listener notified of this ad's lifecycle events.voidshow()Presents the loaded ad.
-
Constructor Details
-
InterstitialAd
Creates an interstitial for the given ad unit id.
Parameters
adUnitId: the ad unit identifier from the network console
-
-
Method Details
-
setAdListener
Sets the listener notified of this ad's lifecycle events. -
getAdListener
The listener notified of this ad's lifecycle events, may be null. -
load
public void load()Loads an ad with default targeting. -
load
Loads an ad using the supplied targeting metadata.
Parameters
request: optional targeting metadata, may be null
-
isLoaded
public boolean isLoaded()True when an ad is loaded and ready toshow(). -
show
public void show()Presents the loaded ad. Does nothing if no ad is loaded. -
dispose
public void dispose()Releases the resources held by this ad.
-