public class RewardedVideoAd extends java.lang.Object implements FullScreenAd
To use the rewarded video, do the following:
RewardedVideoAd ad = new RewardedVideoAd(context, placementId);
RewardedVideoLoadAdConfig loadAdConfig = ad.buildLoadAdConfig()
.withBid(bidPayload)
.withAdListener(adListener)
.build();
ad.loadAd(loadAdConfig);
| Modifier and Type | Class and Description |
|---|---|
static interface |
RewardedVideoAd.RewardedVideoAdLoadConfigBuilder
Builder that allows to configure an ad loading.
|
static interface |
RewardedVideoAd.RewardedVideoAdShowConfigBuilder
Builder that allows to configure an ad showing.
|
static interface |
RewardedVideoAd.RewardedVideoLoadAdConfig
Marker interface for an object that represents an rewarded video ad load config.
|
static interface |
RewardedVideoAd.RewardedVideoShowAdConfig
Marker interface for an object that represents an rewarded video ad show config.
|
FullScreenAd.ShowAdConfig, FullScreenAd.ShowConfigBuilderAd.LoadAdConfig, Ad.LoadConfigBuilder| Modifier and Type | Field and Description |
|---|---|
static int |
UNSET_VIDEO_DURATION |
| Constructor and Description |
|---|
RewardedVideoAd(Context context,
java.lang.String placementID)
Constructs a RewardedVideoAd given the context and the placement id
|
| Modifier and Type | Method and Description |
|---|---|
RewardedVideoAd.RewardedVideoAdLoadConfigBuilder |
buildLoadAdConfig()
Returns
RewardedVideoAd.RewardedVideoAdLoadConfigBuilder that allows to specify ad
loading parameters. |
RewardedVideoAd.RewardedVideoAdShowConfigBuilder |
buildShowAdConfig()
Returns
RewardedVideoAd.RewardedVideoAdLoadConfigBuilder that allows to specify ad
showing parameters. |
void |
destroy()
Destroys the ad control.
|
java.lang.String |
getPlacementId()
Get the placementId for this ad.
|
int |
getVideoDuration() |
boolean |
isAdInvalidated()
Indicate whether the ad is still valid.
|
boolean |
isAdLoaded()
Tells whether an ad is loaded and ready to show
|
void |
loadAd()
Loads an ad.
|
void |
loadAd(RewardedVideoAd.RewardedVideoLoadAdConfig rewardedVideoLoadAdConfig)
Loads an ad.
|
void |
registerAdCompanionView(com.facebook.ads.internal.api.AdCompanionView adCompanionView) |
void |
setExtraHints(ExtraHints extraHints)
Deprecated.
|
boolean |
show()
Shows the rewarded video ad
|
boolean |
show(RewardedVideoAd.RewardedVideoShowAdConfig rewardedVideoShowAdConfig)
Shows the rewarded video ad
|
void |
unregisterAdCompanionView() |
public static final int UNSET_VIDEO_DURATION
public RewardedVideoAd(Context context,
java.lang.String placementID)
context - Android contextplacementID - id of ad placement@Deprecated public void setExtraHints(ExtraHints extraHints)
setExtraHints in interface Adpublic void loadAd()
AdThis 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(RewardedVideoAd.RewardedVideoLoadAdConfig rewardedVideoLoadAdConfig)
This method always returns immediately. The ad is loaded asynchronously. The control's ad listener will be called when loading finishes or fails.
RewardedVideoAd ad = new RewardedVideoAd(context, placementId);
RewardedVideoLoadAdConfig loadAdConfig = ad.buildLoadAdConfig()
.withBid(bidPayload)
.withAdListener(adListener)
.build();
ad.loadAd(loadAdConfig);
public boolean isAdInvalidated()
AdisAdInvalidated in interface Adpublic boolean show()
This method should only be called after loadAd() is
called and the ad listener has been notified ad has loaded
show in interface FullScreenAdpublic boolean show(RewardedVideoAd.RewardedVideoShowAdConfig rewardedVideoShowAdConfig)
This method should only be called after loadAd() is called and the
ad listener has been notified ad has loaded
RewardedVideoShowAdConfig showAdConfig = ad.buildShowAdConfig()
.withAppOrientation(appOrientation)
.build();
ad.show(showAdConfig);
rewardedVideoShowAdConfig - rewarded video ad config.public void destroy()
AdThis method should be called when the hosting activity of the ad control is destroyed.
public boolean isAdLoaded()
public java.lang.String getPlacementId()
AdgetPlacementId in interface Adpublic int getVideoDuration()
public RewardedVideoAd.RewardedVideoAdLoadConfigBuilder buildLoadAdConfig()
RewardedVideoAd.RewardedVideoAdLoadConfigBuilder that allows to specify ad
loading parameters. You should call loadAd(RewardedVideoAd.RewardedVideoLoadAdConfig) after all parameters have
been set.buildLoadAdConfig in interface FullScreenAdpublic RewardedVideoAd.RewardedVideoAdShowConfigBuilder buildShowAdConfig()
RewardedVideoAd.RewardedVideoAdLoadConfigBuilder that allows to specify ad
showing parameters. You should call show(RewardedVideoAd.RewardedVideoShowAdConfig) after all parameters have been
set.buildShowAdConfig in interface FullScreenAdpublic void registerAdCompanionView(com.facebook.ads.internal.api.AdCompanionView adCompanionView)
public void unregisterAdCompanionView()