public final class RewardedAd
extends com.yandex.mobile.ads.fullscreen.FullScreenAd
Constructor and Description |
---|
RewardedAd(android.content.Context context)
Constructs a new
RewardedAd programmatically. |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroys this
RewardedAd entirely and cleans up resources. |
java.lang.String |
getBlockId()
Returns the block id.
|
boolean |
isLoaded()
Returns
true if this rewarded ad has been successfully loaded
and is ready to be shown, otherwise false . |
void |
loadAd(AdRequest adRequest)
Starts loading the ad by
AdRequest on a background thread. |
void |
setBlockId(java.lang.String blockId)
Sets a block id.
|
void |
setRewardedAdEventListener(RewardedAdEventListener rewardedAdEventListener)
Sets an
RewardedAdEventListener . |
void |
setUserId(java.lang.String userId)
Sets a user id.
|
void |
shouldOpenLinksInApp(boolean shouldOpenLinksInApp)
Sets whether web links are opened by in-app browser, or by third-party browsers.
|
void |
show()
Shows the rewarded ad, only if it has been loaded.
|
public RewardedAd(@NonNull android.content.Context context)
RewardedAd
programmatically.context
- The activity context the view is running in, through which it can
access the current theme, resources, etc. In particular, it
uses the window manager and theme in this context to present its UI.public java.lang.String getBlockId()
public void loadAd(AdRequest adRequest)
AdRequest
on a background thread.
NOTE:
The block id must be set before that.adRequest
- AdRequest
public boolean isLoaded()
true
if this rewarded ad has been successfully loaded
and is ready to be shown, otherwise false
.true
if this rewarded ad has been successfully
loaded and is ready to be shown.public void setBlockId(java.lang.String blockId)
blockId
- Unique ad placement ID created at partner interface.public void setUserId(java.lang.String userId)
userId
- Unique string that identifies app's user. Created at partner interface.public void setRewardedAdEventListener(@Nullable RewardedAdEventListener rewardedAdEventListener)
RewardedAdEventListener
.rewardedAdEventListener
- RewardedAdEventListener
.public void shouldOpenLinksInApp(boolean shouldOpenLinksInApp)
shouldOpenLinksInApp
- If set to true
, web links are opened by in-app browser,
otherwise by third-party browsers. Default param is false
public void show()
public void destroy()
RewardedAd
entirely and cleans up resources.
NOTE:
Don't work with this RewardedAd
thereafter.