InterstitialAd
有此級別的更新版本。前往查看 最新版本。

InterstitialAd displays an advertisement by Facebook in an interstitial.

To use the interstitial, do the following:

InterstitialAd interstitial = new InterstitialAd(context, PLACEMENT_ID); interstitial.setAdListener(new InterstitialAdListener() { public void onAdLoaded(Ad ad) { if (ad == interstitial) { interstitial.show(); } } // rest of InterstitialAdListener implementation omitted }); interstitial.loadAd();

InterstitialAd requires InterstitialAdActivity to be declared in app's AndroidManifest.xml with android:configChanges="keyboardHidden|orientation".

伸延:Object
實作Ad
套件:ads
建構函式
InterstitialAd(Context, String)

Constructs an InterstitialAd using the given context and placement id.

public InterstitialAd(Context context, String placementId)
參數說明
contextAndroid context
placementIdId of ad placement
執行個體方法
setAdListener(InterstitialAdListener)

Sets an InterstitialAdListener to be notified on events in control lifecycle.

public void setAdListener(InterstitialAdListener adListener)
參數說明
adListenerThe listener
setImpressionListener(ImpressionListener)

Sets an ImpressionListener to be notified of impression events in ad control lifecycle.

public void setImpressionListener(ImpressionListener impListener)
參數說明
impListenerThe listener
loadAd()

Loads an ad.

This method always returns immediately. The ad is loaded asynchronously. The control's ad listener will be called when loading finishes or fails.

public void loadAd()
loadAd()
public void loadAd()
destroy()

Destroys the ad control.

This method should be called when the hosting activity of the ad control is destroyed.

public void destroy()
destroy()
public void destroy()
isAdLoaded()

Gets whether an ad is loaded and ready to show.

public boolean isAdLoaded()
Returns
Whether an ad is loaded
show()

Shows the interstitial ad.

This method should only be called after InterstitialAd.loadAd() is called and the listener is notified ad has been loaded.

public boolean show()
Returns
False if no ad is loaded, otherwise true
常數
SEPARATOR
public static final String SEPARATOR
INTERSTITIAL_DISPLAYED
public static final String INTERSTITIAL_DISPLAYED
INTERSTITIAL_DISMISSED
public static final String INTERSTITIAL_DISMISSED
INTERSTITIAL_CLICKED
public static final String INTERSTITIAL_CLICKED
IMPRESSION_WILL_LOG
public static final String IMPRESSION_WILL_LOG
INTERSTITIAL_UNIQUE_ID_EXTRA
public static final String INTERSTITIAL_UNIQUE_ID_EXTRA
DISPLAY_ROTATION_INTENT_EXTRA
public static final String DISPLAY_ROTATION_INTENT_EXTRA
DISPLAY_WIDTH_INTENT_EXTRA
public static final String DISPLAY_WIDTH_INTENT_EXTRA
DISPLAY_HEIGHT_INTENT_EXTRA
public static final String DISPLAY_HEIGHT_INTENT_EXTRA
IS_TABLET_INTENT_EXTRA
public static final String IS_TABLET_INTENT_EXTRA
AD_HEIGHT_INTENT_EXTRA
public static final String AD_HEIGHT_INTENT_EXTRA
AD_WIDTH_INTENT_EXTRA
public static final String AD_WIDTH_INTENT_EXTRA
USE_NATIVE_CLOSE_BUTTON_EXTRA
public static final String USE_NATIVE_CLOSE_BUTTON_EXTRA