Android SDK Version
  • java.lang.Object
    • RelativeLayout
      • com.facebook.ads.InstreamVideoAdView
All Implemented Interfaces:

public class InstreamVideoAdView
extends RelativeLayout
implements Ad
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(); 
Since:
4.23
Constructor Summary
Constructor and Description
InstreamVideoAdView(Context context, Bundle previousState) 
InstreamVideoAdView(Context context, java.lang.String placementID, AdSize adSize)
Constructs a InstreamVideoAdView given the context and the placement id
Method Summary
Modifier and TypeMethod and Description
voiddestroy()
Destroys the ad control.
java.lang.StringgetPlacementId()
Get the placementId for this ad.
BundlegetSaveInstanceState() 
booleanisAdInvalidated()
Indicate whether the ad is still valid.
booleanisAdLoaded()
Tells whether an ad is loaded and ready to show
voidloadAd()
Loads an ad.
voidloadAdFromBid(java.lang.String bidPayload)
Loads an ad from the payload supplied with a bid.
voidsetAdListener(InstreamVideoAdListener adListener)
Sets an InstreamVideoAdListener to be notified on events in control lifecycle.
voidsetExtraHints(ExtraHints extraHints) 
booleanshow()
Shows the Instream video ad
This method should only be called after loadAd() is called and the ad listener has been notified ad has loaded
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail

InstreamVideoAdView

public InstreamVideoAdView(Context context,
                           Bundle previousState)
Parameters:
context -
previousState -
Since:
4.23

InstreamVideoAdView

public InstreamVideoAdView(Context context,
                           java.lang.String placementID,
                           AdSize adSize)
Constructs a InstreamVideoAdView given the context and the placement id
Parameters:
context - Android context
placementID - id of ad placement eg. 12345_12345
adSize - the intended size of the placement
Since:
4.23
Method Detail

loadAd

public void loadAd()
Description copied from interface: Ad
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.
Specified by:
loadAd in interface Ad
Since:
4.23

loadAdFromBid

public void loadAdFromBid(java.lang.String bidPayload)
Description copied from interface: Ad
Loads an ad from the payload supplied with a bid.
This method always returns immediately. The ad is loaded asynchronously. If available, the ad listener will be called when loading finishes or fails.
Specified by:
loadAdFromBid in interface Ad
Parameters:
bidPayload - The payload supplied with the bid
Since:
4.28

isAdInvalidated

public boolean isAdInvalidated()
Description copied from interface: Ad
Indicate whether the ad is still valid.
Specified by:
isAdInvalidated in interface Ad
Returns:
true if the ad is not valid anymore.

show

public boolean show()
Shows the Instream video ad
This method should only be called after loadAd() is called and the ad listener has been notified ad has loaded
Returns:
false if no ad is loaded, true otherwise
Since:
4.23

setAdListener

public void setAdListener(InstreamVideoAdListener adListener)
Sets an InstreamVideoAdListener to be notified on events in control lifecycle.
Parameters:
adListener -
Since:
4.23

setExtraHints

public void setExtraHints(ExtraHints extraHints)
Specified by:
setExtraHints in interface Ad

destroy

public void destroy()
Description copied from interface: Ad
Destroys the ad control.
This method should be called when the hosting activity of the ad control is destroyed.
Specified by:
destroy in interface Ad
Since:
4.23

isAdLoaded

public boolean isAdLoaded()
Tells whether an ad is loaded and ready to show
Returns:
whether an ad is loaded
Since:
4.23

getPlacementId

public java.lang.String getPlacementId()
Description copied from interface: Ad
Get the placementId for this ad.
Specified by:
getPlacementId in interface Ad
Returns:
Since:
4.23

getSaveInstanceState

public Bundle getSaveInstanceState()
Returns:
Since:
4.23