RewardedInterstitialAd

public abstract class RewardedInterstitialAd


Rewarded interstitials are full screen ads that reward users and can be shown without a user opt in.

This ad format is different than com.google.android.gms.ads.rewarded.RewardedAd because rewarded ads require the user to opt-in to watching the video. This ad format is different than com.google.android.gms.ads.interstitial.InterstitialAd because interstitial ads do not reward the user.

Summary

Public constructors

Public methods

abstract @NonNull Bundle

Gets all available ad metadata for this RewardedInterstitialAd.

abstract @NonNull String

Returns the ad unit ID.

abstract @Nullable FullScreenContentCallback

Gets the FullScreenContentCallback for this RewardedInterstitialAd.

abstract @Nullable OnAdMetadataChangedListener

Gets the OnAdMetadataChangedListener for this RewardedInterstitialAd.

abstract @Nullable OnPaidEventListener

Gets the OnPaidEventListener for this RewardedInterstitialAd.

abstract @NonNull ResponseInfo

Returns information about the loaded ad.

abstract @NonNull RewardItem

Gets reward item for the loaded rewarded interstitial ad.

static void
load(
    @NonNull Context context,
    @NonNull String adUnitId,
    @NonNull AdManagerAdRequest adManagerAdRequest,
    @NonNull RewardedInterstitialAdLoadCallback loadCallback
)

Loads a RewardedInterstitialAd.

static void
load(
    @NonNull Context context,
    @NonNull String adUnitId,
    @NonNull AdRequest adRequest,
    @NonNull RewardedInterstitialAdLoadCallback loadCallback
)

Loads a RewardedInterstitialAd.

abstract void

Registers a callback to be invoked when ads show and dismiss full screen content.

abstract void
setImmersiveMode(boolean immersiveModeEnabled)

Sets a flag that controls if this rewarded interstitial ad object will be displayed in immersive mode.

abstract void

Registers a callback to be invoked when the rewarded interstitial ad's metadata changes.

abstract void

Registers a callback to be invoked when this ad is estimated to have earned money.

abstract void

Sets ServerSideVerificationOptions for this rewarded interstitial ad.

abstract void
show(
    @NonNull Activity activity,
    @NonNull OnUserEarnedRewardListener onUserEarnedRewardListener
)

Shows the rewarded interstitial ad.

Public constructors

RewardedInterstitialAd

public RewardedInterstitialAd()

Public methods

getAdMetadata

public abstract @NonNull Bundle getAdMetadata()

Gets all available ad metadata for this RewardedInterstitialAd. Ad metadata is empty if the ad doesn't have metadata. Ad metadata may update. Use onAdMetadataChanged to listen for changes.

getAdUnitId

public abstract @NonNull String getAdUnitId()

Returns the ad unit ID.

getFullScreenContentCallback

public abstract @Nullable FullScreenContentCallback getFullScreenContentCallback()

Gets the FullScreenContentCallback for this RewardedInterstitialAd.

getOnAdMetadataChangedListener

public abstract @Nullable OnAdMetadataChangedListener getOnAdMetadataChangedListener()

Gets the OnAdMetadataChangedListener for this RewardedInterstitialAd.

getOnPaidEventListener

public abstract @Nullable OnPaidEventListener getOnPaidEventListener()

Gets the OnPaidEventListener for this RewardedInterstitialAd.

getResponseInfo

public abstract @NonNull ResponseInfo getResponseInfo()

Returns information about the loaded ad.

getRewardItem

public abstract @NonNull RewardItem getRewardItem()

Gets reward item for the loaded rewarded interstitial ad.

load

public static void load(
    @NonNull Context context,
    @NonNull String adUnitId,
    @NonNull AdManagerAdRequest adManagerAdRequest,
    @NonNull RewardedInterstitialAdLoadCallback loadCallback
)

Loads a RewardedInterstitialAd.

Parameters
@NonNull Context context

The context.

@NonNull String adUnitId

The ad unit ID.

@NonNull AdManagerAdRequest adManagerAdRequest

A Google Ad Manager ad request with targeting information.

@NonNull RewardedInterstitialAdLoadCallback loadCallback

A callback to be invoked when a rewarded interstitial ad finishes loading.

load

public static void load(
    @NonNull Context context,
    @NonNull String adUnitId,
    @NonNull AdRequest adRequest,
    @NonNull RewardedInterstitialAdLoadCallback loadCallback
)

Loads a RewardedInterstitialAd.

Parameters
@NonNull Context context

The context.

@NonNull String adUnitId

The ad unit ID.

@NonNull AdRequest adRequest

An ad request with targeting information.

@NonNull RewardedInterstitialAdLoadCallback loadCallback

A callback to be invoked when a rewarded interstitial ad finishes loading.

setFullScreenContentCallback

public abstract void setFullScreenContentCallback(
    @Nullable FullScreenContentCallback fullScreenContentCallback
)

Registers a callback to be invoked when ads show and dismiss full screen content.

setImmersiveMode

public abstract void setImmersiveMode(boolean immersiveModeEnabled)

Sets a flag that controls if this rewarded interstitial ad object will be displayed in immersive mode. Call this method before show. During show, if this flag is on and immersive mode is supported, SYSTEM_UI_FLAG_IMMERSIVE_STICKY &SYSTEM_UI_FLAG_HIDE_NAVIGATION will be turned on for the rewarded ad.

setOnAdMetadataChangedListener

public abstract void setOnAdMetadataChangedListener(
    @Nullable OnAdMetadataChangedListener listener
)

Registers a callback to be invoked when the rewarded interstitial ad's metadata changes.

setOnPaidEventListener

public abstract void setOnPaidEventListener(@Nullable OnPaidEventListener listener)

Registers a callback to be invoked when this ad is estimated to have earned money.

setServerSideVerificationOptions

public abstract void setServerSideVerificationOptions(
    ServerSideVerificationOptions options
)

Sets ServerSideVerificationOptions for this rewarded interstitial ad.

show

public abstract void show(
    @NonNull Activity activity,
    @NonNull OnUserEarnedRewardListener onUserEarnedRewardListener
)

Shows the rewarded interstitial ad.

Parameters
@NonNull Activity activity

The activity from which the rewarded ad should be shown.

@NonNull OnUserEarnedRewardListener onUserEarnedRewardListener

The listener to be notified when user earns a reward.