Skip to content

1.4 Methods for Interstitial

Raymond Xie edited this page Apr 1, 2017 · 4 revisions

AdMob.prepareInterstitial(adId/options, success, fail)

Purpose: prepare an interstitial Ad for showing.

Params:

  • adId, string, Ad unit Id for the full screen Ad.
  • options, string, see *AdMob.setOptions()
  • success, function, callback when success, can be null or missing.
  • fail, function, callback when fail, can be null or missing.

Extra key/value for param options

  • adId, string, Ad unit Id for this interstitial.
  • success, function, callback when success.
  • error, function, call back when fail.

Note: it will take some time to get Ad resource before it can be showed. It's more recommended by AdMob official, you may buffer the Ad by calling requestInterstitial, and show it later.

AdMob.showInterstitial()

Purpose: show interstitial Ad when it's ready.

AdMob.isInterstitialReady(callback)

Purpose: check to confirm interstitial Ad is ready to show.

Example Code:

// prepare at beginning of a game level
AdMob.prepareInterstitial({
	adId: admobid.interstitial,
	autoShow: false
});
// check and show it at end of a game level
AdMob.isInterstitialReady(function(isready){
	if(isready) AdMob.showInterstitial();
});