Skip to main content

RewardedAd

import { RewardedAd } from 'nitro-ui-admob'

A full-screen ad that grants a reward when watched. Each loaded ad can be shown once, within one hour of loading. Guide: rewarded ads.

MemberDescription
load(adUnitId, options?)Loads an ad.
expiresAtWhen the ad expires.
rewardThe reward the ad grants.
onUserEarnedRewardCalled when the user earned the reward.
setServerSideVerificationOptions(options)Data for your server-side verification callback.
show()Presents the ad once.
CallbacksThe shared full-screen events.

load​

static load(adUnitId: string, options?: AdmobRequestOptions): Promise<RewardedAd>

Loads an ad, starting the SDK if needed. options is an AdmobRequestOptions. Rejects with "<code>: <message>" from the SDK.

expiresAt​

readonly expiresAt: number

When the ad expires, in milliseconds since the Unix epoch: one hour after loading.

reward​

readonly reward: AdmobReward

The AdmobReward granted when the user finishes the ad, as configured in the AdMob UI.

onUserEarnedReward​

onUserEarnedReward?: (reward: AdmobReward) => void

Called when the user earned reward.

setServerSideVerificationOptions​

setServerSideVerificationOptions(options: AdmobServerSideVerificationOptions): void

Sets the data forwarded to your server-side verification callback. Call it before show. See AdmobServerSideVerificationOptions.

show​

show(): void

Presents the ad over the current screen. Callbacks, including onUserEarnedReward, are cleared once it is dismissed or fails to show.

Throws if this ad was already shown or has expired.

Callbacks​

CallbackTypeCalled when
onAdShown() => voidThe ad starts covering the screen.
onAdDismissed() => voidThe user dismissed the ad.
onAdFailedToShow(error: AdmobError) => voidThe ad could not be presented.
onAdImpression() => voidThe SDK recorded an impression.
onAdClicked() => voidThe SDK recorded a click.
onAdPaid(value: AdmobAdValue) => voidWith the estimated revenue of the impression.