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

public class RewardedVideoAd
extends java.lang.Object
implements Ad
RewardedVideoAd displays a rewarded video advertisement by Facebook
To use the rewarded video, do the following:
 RewardedVideoAd rewardedVideo = new RewardedVideoAd(context, PLACEMENT_ID); rewardedVideo.setAdListener(new AbstractAdListener() { public void onAdLoaded(Ad ad) { } }); rewardedVideo.loadAd(); 
Since:
4.23
Field Summary
Modifier and TypeField and Description
static intUNSET_VIDEO_DURATION 
Constructor Summary
Constructor and Description
RewardedVideoAd(Context context, java.lang.String placementID)
Constructs a RewardedVideoAd 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.
intgetVideoDuration() 
booleanisAdInvalidated()
Indicate whether the ad is still valid.
booleanisAdLoaded()
Tells whether an ad is loaded and ready to show
voidloadAd()
Loads an ad.
voidloadAd(boolean failOnCacheFailure) 
voidloadAdFromBid(java.lang.String bidPayload)
Loads an ad from the payload supplied with a bid.
voidloadAdFromBid(java.lang.String bidPayload, boolean failOnCacheFailure) 
voidsetAdListener(RewardedVideoAdListener adListener)
Sets an RewardedVideoAdListener to be notified on events in control lifecycle.
voidsetExtraHints(ExtraHints extraHints) 
voidsetRewardData(RewardData rewardData) 
booleanshow()
Shows the rewarded video ad
This method should only be called after loadAd() is called and the ad listener has been notified ad has loaded
booleanshow(int appOrientation)
Shows the rewarded 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
Field Detail

UNSET_VIDEO_DURATION

public static final int UNSET_VIDEO_DURATION
Constructor Detail

RewardedVideoAd

public RewardedVideoAd(Context context,
                       java.lang.String placementID)
Constructs a RewardedVideoAd given the context and the placement id
Parameters:
context - Android context
placementID - id of ad placement
Method Detail

setExtraHints

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

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

loadAd

public void loadAd(boolean failOnCacheFailure)

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

loadAdFromBid

public void loadAdFromBid(java.lang.String bidPayload,
                          boolean failOnCacheFailure)

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 rewarded 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

show

public boolean show(int appOrientation)
Shows the rewarded video ad
This method should only be called after loadAd() is called and the ad listener has been notified ad has loaded
Parameters:
appOrientation - orientation of the calling app
Returns:
false if no ad is loaded, true otherwise

setAdListener

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

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

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

setRewardData

public void setRewardData(RewardData rewardData)
Parameters:
rewardData -
Since:
4.23

getVideoDuration

public int getVideoDuration()
Returns:
Since:
4.28