Google is committed to advancing racial equity for Black communities. See how.

RewardedAdCallback

public abstract class RewardedAdCallback extends Object

A listener for receiving notifications during the lifecycle of a rewarded ad.

Constant Summary

int ERROR_CODE_AD_REUSED The rewarded ad has already been shown.
int ERROR_CODE_APP_NOT_FOREGROUND The rewarded ad can not be shown when app is not in foreground.
int ERROR_CODE_INTERNAL_ERROR Something happened internally.
int ERROR_CODE_MEDIATION_SHOW_ERROR A mediation adapter failed to show the ad.
int ERROR_CODE_NOT_READY The rewarded ad is not ready.

Public Constructor Summary

Public Method Summary

void
onRewardedAdClosed()
Called when a rewarded ad is closed.
void
onRewardedAdFailedToShow(AdError adError)
Called when a rewarded ad failed to show.
void
onRewardedAdFailedToShow(int errorCode)
This method is deprecated. Use onRewardedAdFailedToShow(AdError) instead.
void
onRewardedAdOpened()
Called when a rewarded ad opens a overlay that covers the screen.
abstract void
onUserEarnedReward(RewardItem reward)
Called when a rewarded ad triggers a reward.

Inherited Method Summary

Constants

public static final int ERROR_CODE_AD_REUSED

The rewarded ad has already been shown.

Constant Value: 1

public static final int ERROR_CODE_APP_NOT_FOREGROUND

The rewarded ad can not be shown when app is not in foreground.

Constant Value: 3

public static final int ERROR_CODE_INTERNAL_ERROR

Something happened internally.

Constant Value: 0

public static final int ERROR_CODE_MEDIATION_SHOW_ERROR

A mediation adapter failed to show the ad. If this error is returned from getCode(), check getCause() for the underlying cause.

Constant Value: 4

public static final int ERROR_CODE_NOT_READY

The rewarded ad is not ready.

Constant Value: 2

Public Constructors

public RewardedAdCallback ()

Public Methods

public void onRewardedAdClosed ()

Called when a rewarded ad is closed.

public void onRewardedAdFailedToShow (AdError adError)

Called when a rewarded ad failed to show.

Parameters
adError AdError detailing the cause of the failure. getCode() is one of the error code constants defined in RewardedAdCallback.

public void onRewardedAdFailedToShow (int errorCode)

This method is deprecated.
Use onRewardedAdFailedToShow(AdError) instead.

Called when a rewarded ad failed to show. The error code is one of the error code constants defined in RewardedAdCallback.

public void onRewardedAdOpened ()

Called when a rewarded ad opens a overlay that covers the screen.

public abstract void onUserEarnedReward (RewardItem reward)

Called when a rewarded ad triggers a reward. The app is responsible for crediting the user with the reward.

Parameters
reward the reward to grant the user. This value will never be null. If the ad does not specify a reward amount and no override is provided for this ad unit on the Admob UI, the default reward (DEFAULT_REWARD) will have an amount of 1 and a type of "".