public class RewardedInterstitialAd extends java.lang.Object implements FullScreenAd
To use the rewarded video, do the following:
RewardedInterstitialAd ad = new RewardedInterstitialAd(context, placementId);
RewardedInterstitialLoadAdConfig loadAdConfig = ad.buildLoadAdConfig()
.withBid(bidPayload)
.withAdListener(adListener)
.build();
ad.loadAd(loadAdConfig);
// After adListener.onAdLoaded has been called:
RewardedInterstitialShowAdConfig showAdConfig = ad.buildShowAdConfig()
.withAppOrientation(appOrientation)
.build();
ad.show(showAdConfig);
Modifier and Type | Class and Description |
---|---|
static interface |
RewardedInterstitialAd.RewardedInterstitialAdLoadConfigBuilder
Builder that allows to configure ad loading.
|
static interface |
RewardedInterstitialAd.RewardedInterstitialAdShowConfigBuilder
Builder that allows to configure an ad showing.
|
static interface |
RewardedInterstitialAd.RewardedInterstitialLoadAdConfig
Marker interface for an object that represents an rewarded video ad load config.
|
static interface |
RewardedInterstitialAd.RewardedInterstitialShowAdConfig
Marker interface for an object that represents an rewarded video ad show config.
|
FullScreenAd.ShowAdConfig, FullScreenAd.ShowConfigBuilder
Ad.LoadAdConfig, Ad.LoadConfigBuilder
Modifier and Type | Field and Description |
---|---|
static int |
UNSET_VIDEO_DURATION
Default value returned from
getVideoDuration() when the duration
of the video is not known (e.g. |
Constructor and Description |
---|
RewardedInterstitialAd(Context context,
java.lang.String placementID)
Constructs a RewardedInterstitialAd given the context and the placement id.
|
Modifier and Type | Method and Description |
---|---|
RewardedInterstitialAd.RewardedInterstitialAdLoadConfigBuilder |
buildLoadAdConfig()
Returns
RewardedInterstitialAd.RewardedInterstitialAdLoadConfigBuilder that allows to
specify ad loading parameters. |
RewardedInterstitialAd.RewardedInterstitialAdShowConfigBuilder |
buildShowAdConfig()
Returns
RewardedInterstitialAd.RewardedInterstitialAdLoadConfigBuilder that allows to
specify ad showing parameters. |
void |
destroy()
Destroys the ad control.
|
java.lang.String |
getPlacementId()
Returns the placement id
RewardedInterstitialAd was initialised with. |
int |
getVideoDuration()
Returns the duration of the video ad in seconds, if it's loaded,
UNSET_VIDEO_DURATION otherwise. |
boolean |
isAdInvalidated()
Checks whether ad is invalidated, e.g.
|
boolean |
isAdLoaded()
Tells whether an ad is loaded and ready to show.
|
void |
loadAd()
Loads an ad.
|
void |
loadAd(RewardedInterstitialAd.RewardedInterstitialLoadAdConfig RewardedInterstitialLoadAdConfig)
Loads an ad.
|
void |
setExtraHints(ExtraHints extraHints)
Deprecated.
6.7
|
boolean |
show()
Shows the rewarded video ad.
|
boolean |
show(RewardedInterstitialAd.RewardedInterstitialShowAdConfig RewardedInterstitialShowAdConfig)
Shows the rewarded video ad.
|
public static final int UNSET_VIDEO_DURATION
getVideoDuration()
when the duration
of the video is not known (e.g. ad was not yet loaded).public RewardedInterstitialAd(Context context, java.lang.String placementID)
context
- Android context.placementID
- id of ad placement.@Deprecated public void setExtraHints(ExtraHints extraHints)
ExtraHints
. Using ExtraHints has been deprecated and this method is provided only
for legacy reasons.setExtraHints
in interface Ad
public void loadAd()
RewardedInterstitialAdListener
so you won't be notified of important events in the ad's
lifecycle.public void loadAd(RewardedInterstitialAd.RewardedInterstitialLoadAdConfig RewardedInterstitialLoadAdConfig)
This method always returns immediately. The ad is loaded asynchronously. The control's ad listener will be called when loading finishes or fails.
RewardedInterstitialAd ad = new RewardedInterstitialAd(context, placementId);
RewardedInterstitialLoadAdConfig loadAdConfig = ad.buildLoadAdConfig()
.withBid(bidPayload)
.withAdListener(adListener)
.build();
ad.loadAd(loadAdConfig);
public boolean isAdInvalidated()
isAdInvalidated
in interface Ad
public 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 FullScreenAd
public boolean show(RewardedInterstitialAd.RewardedInterstitialShowAdConfig RewardedInterstitialShowAdConfig)
This method should only be called after loadAd()
is called
and the ad listener provided with RewardedInterstitialAd.RewardedInterstitialAdLoadConfigBuilder.withAdListener(RewardedInterstitialAdListener)
has
been notified an ad has loaded.
RewardedInterstitialShowAdConfig showAdConfig = ad.buildShowAdConfig()
.withAppOrientation(appOrientation)
.build();
ad.show(showAdConfig);
RewardedInterstitialShowAdConfig
- rewarded video ad config.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()
RewardedInterstitialAd
was initialised with.getPlacementId
in interface Ad
RewardedInterstitialAd
was initialised with.public int getVideoDuration()
UNSET_VIDEO_DURATION
otherwise.UNSET_VIDEO_DURATION
otherwise.public RewardedInterstitialAd.RewardedInterstitialAdLoadConfigBuilder buildLoadAdConfig()
RewardedInterstitialAd.RewardedInterstitialAdLoadConfigBuilder
that allows to
specify ad loading parameters. You should call loadAd(RewardedInterstitialAd.RewardedInterstitialLoadAdConfig)
after
all parameters have been set.buildLoadAdConfig
in interface FullScreenAd
public RewardedInterstitialAd.RewardedInterstitialAdShowConfigBuilder buildShowAdConfig()
RewardedInterstitialAd.RewardedInterstitialAdLoadConfigBuilder
that allows to
specify ad showing parameters. You should call show(RewardedInterstitialAd.RewardedInterstitialShowAdConfig)
after all
parameters have been set.buildShowAdConfig
in interface FullScreenAd