public class RewardedVideoAd extends java.lang.Object implements Ad
RewardedVideoAd rewardedVideo = new RewardedVideoAd(context, PLACEMENT_ID);
rewardedVideo.setAdListener(new AbstractAdListener() {
public void onAdLoaded(Ad ad) {
}
});
rewardedVideo.loadAd();
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 |
---|---|
void |
destroy()
Destroys the ad control.
|
void |
enableRVChain(boolean enabled)
Whether we should enable RV ads to be shown in succession after the previous one finishes.
|
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(boolean failOnCacheFailure) |
void |
loadAdFromBid(java.lang.String bidPayload)
Loads an ad from the payload supplied with a bid.
|
void |
loadAdFromBid(java.lang.String bidPayload,
boolean failOnCacheFailure) |
void |
setAdListener(RewardedVideoAdListener adListener)
Sets an RewardedVideoAdListener to be notified on events in control lifecycle.
|
void |
setExtraHints(ExtraHints extraHints) |
void |
setRewardData(RewardData rewardData) |
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 |
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 |
public static final int UNSET_VIDEO_DURATION
public RewardedVideoAd(Context context, java.lang.String placementID)
context
- Android contextplacementID
- id of ad placementpublic void setExtraHints(ExtraHints extraHints)
setExtraHints
in interface Ad
public void enableRVChain(boolean enabled)
public void loadAd()
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(boolean failOnCacheFailure)
public void loadAdFromBid(java.lang.String bidPayload)
Ad
loadAdFromBid
in interface Ad
bidPayload
- The payload supplied with the bidpublic void loadAdFromBid(java.lang.String bidPayload, boolean failOnCacheFailure)
public boolean isAdInvalidated()
Ad
isAdInvalidated
in interface Ad
public boolean show()
loadAd()
is called and the ad listener has been notified ad has loadedpublic boolean show(int appOrientation)
loadAd()
is called and the ad listener has been notified ad has loadedappOrientation
- orientation of the calling apppublic void setAdListener(RewardedVideoAdListener adListener)
adListener
- public void destroy()
Ad
This method should be called when the hosting activity of the ad control is destroyed.
public boolean isAdLoaded()
public java.lang.String getPlacementId()
Ad
getPlacementId
in interface Ad
public void setRewardData(RewardData rewardData)
rewardData
- public int getVideoDuration()