RewardedInterstitialAd

public abstract class RewardedInterstitialAd


插頁式獎勵廣告是全螢幕廣告,會提供獎勵給使用者,且不需要使用者選擇觀看即可顯示。

這種廣告格式與com.google.android.gms.ads.rewarded.RewardedAd不同,因為獎勵廣告需要使用者選擇觀看影片。插頁式廣告不會提供獎勵給使用者,因此與com.google.android.gms.ads.interstitial.InterstitialAd不同。

摘要

公用建構函式

公用方法

abstract @NonNull Bundle

取得這個 RewardedInterstitialAd 的所有可用廣告中繼資料。

abstract @NonNull String

傳回廣告單元 ID。

abstract @Nullable FullScreenContentCallback

取得這個 RewardedInterstitialAdFullScreenContentCallback

abstract @Nullable OnAdMetadataChangedListener

取得這個 RewardedInterstitialAdOnAdMetadataChangedListener

abstract @Nullable OnPaidEventListener

取得這個 RewardedInterstitialAdOnPaidEventListener

abstract long

取得這個 RewardedInterstitialAd 的刊登位置 ID。

abstract @NonNull ResponseInfo

傳回所載入廣告的相關資訊。

abstract @NonNull RewardItem

取得已載入插頁式獎勵廣告的獎勵項目。

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

載入 RewardedInterstitialAd

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

載入 RewardedInterstitialAd

abstract void

註冊回呼,在廣告顯示及關閉全螢幕內容時叫用。

abstract void
setImmersiveMode(boolean immersiveModeEnabled)

設定旗標,控管是否要在沉浸模式中顯示這個獎勵插頁式廣告物件。

abstract void

註冊回呼,在獲得獎勵的插頁式廣告中繼資料變更時叫用。

abstract void

註冊回呼,在預估這則廣告已賺取收益時叫用。

abstract void
setPlacementId(long placementId)

設定插頁式獎勵廣告的刊登位置 ID。

abstract void

為這個插頁式獎勵廣告設定 ServerSideVerificationOptions

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

顯示插頁式獎勵廣告。

公用建構函式

RewardedInterstitialAd

public RewardedInterstitialAd()

公用方法

getAdMetadata

public abstract @NonNull Bundle getAdMetadata()

取得這個 RewardedInterstitialAd 的所有可用廣告中繼資料。如果廣告沒有中繼資料,廣告中繼資料就會是空白。廣告中繼資料可能會更新。使用 onAdMetadataChanged 監聽變更。

getAdUnitId

public abstract @NonNull String getAdUnitId()

傳回廣告單元 ID。

getFullScreenContentCallback

public abstract @Nullable FullScreenContentCallback getFullScreenContentCallback()

取得這個 RewardedInterstitialAdFullScreenContentCallback

getOnAdMetadataChangedListener

public abstract @Nullable OnAdMetadataChangedListener getOnAdMetadataChangedListener()

取得這個 RewardedInterstitialAdOnAdMetadataChangedListener

getOnPaidEventListener

public abstract @Nullable OnPaidEventListener getOnPaidEventListener()

取得這個 RewardedInterstitialAdOnPaidEventListener

getPlacementId

public abstract long getPlacementId()

取得這個 RewardedInterstitialAd 的刊登位置 ID。

getResponseInfo

public abstract @NonNull ResponseInfo getResponseInfo()

傳回所載入廣告的相關資訊。

getRewardItem

public abstract @NonNull RewardItem getRewardItem()

取得已載入插頁式獎勵廣告的獎勵項目。

load

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

載入 RewardedInterstitialAd

參數
@NonNull Context context

背景資訊。

@NonNull String adUnitId

廣告單元 ID。

@NonNull AdManagerAdRequest adManagerAdRequest

包含指定目標資訊的 Google Ad Manager 廣告請求。

@NonNull RewardedInterstitialAdLoadCallback loadCallback

插頁式獎勵廣告載入完成時要叫用的回呼。

load

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

載入 RewardedInterstitialAd

參數
@NonNull Context context

背景資訊。

@NonNull String adUnitId

廣告單元 ID。

@NonNull AdRequest adRequest

含有指定目標資訊的廣告請求。

@NonNull RewardedInterstitialAdLoadCallback loadCallback

插頁式獎勵廣告載入完成時要叫用的回呼。

setFullScreenContentCallback

public abstract void setFullScreenContentCallback(
    @Nullable FullScreenContentCallback fullScreenContentCallback
)

註冊回呼,在廣告顯示及關閉全螢幕內容時叫用。

setImmersiveMode

public abstract void setImmersiveMode(boolean immersiveModeEnabled)

設定旗標,控管是否要在沉浸模式中顯示這個獎勵插頁式廣告物件。請在 show 之前呼叫這個方法。在 show 期間,如果這個旗標已開啟且支援沉浸模式,系統會為有獎廣告開啟 SYSTEM_UI_FLAG_IMMERSIVE_STICKY 和 SYSTEM_UI_FLAG_HIDE_NAVIGATION。

setOnAdMetadataChangedListener

public abstract void setOnAdMetadataChangedListener(
    @Nullable OnAdMetadataChangedListener listener
)

註冊回呼,在獲得獎勵的插頁式廣告中繼資料變更時叫用。

setOnPaidEventListener

public abstract void setOnPaidEventListener(@Nullable OnPaidEventListener listener)

註冊回呼,在預估這則廣告已賺取收益時叫用。

setPlacementId

public abstract void setPlacementId(long placementId)

設定插頁式獎勵廣告的刊登位置 ID。

為確保報表會納入這個刊登位置 ID,請在顯示廣告前呼叫這個方法。

參數
long placementId

AdMob 使用者介面為已設定的刊登位置提供的長整數。

setServerSideVerificationOptions

public abstract void setServerSideVerificationOptions(
    ServerSideVerificationOptions options
)

為這個插頁式獎勵廣告設定 ServerSideVerificationOptions

顯示

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

顯示插頁式獎勵廣告。

參數
@NonNull Activity activity

顯示獎勵廣告的活動。

@NonNull OnUserEarnedRewardListener onUserEarnedRewardListener

使用者獲得獎勵時,系統會通知這個監聽器。