InstreamVideoAd displays a Instream video advertisement by Facebook
To use the Instream video, do the following:
InstreamVideoAdView InstreamVideo = new InstreamVideoAdView(context, PLACEMENT_ID); InstreamVideoView.setAdListener(new AbstractAdListener() { public void onAdLoaded(Ad ad) { } });
InstreamVideoView.loadAd();
伸延: | RelativeLayout |
實作 | Ad |
套件: | ads |
InstreamVideoAdView(Context, String, AdSize)
Constructs a InstreamVideoAdView given the context and the placement id
public InstreamVideoAdView(Context context, String placementID, AdSize adSize)
參數 | 說明 |
---|---|
context | Android context |
placementID | Id of ad placement eg. 12345_12345 |
adSize | The intended size of the placement |
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()
show()
Shows the Instream video ad
This method should only be called after InstreamVideoAdView.loadAd() is called and the ad listener has been notified ad has loaded
public boolean show()
setAdListener(InstreamVideoAdListener)
Sets an InstreamVideoAdListener to be notified on events in control lifecycle.
public void setAdListener(InstreamVideoAdListener adListener)
參數 | 說明 |
---|---|
adListener |
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()
Tells whether an ad is loaded and ready to show
public boolean isAdLoaded()
getPlacementId()
Get the placementId for this ad.
public String getPlacementId()
getPlacementId()
public String getPlacementId()