@idleflowgames/admob
v9.0.0
Published
A native plugin for AdMob
Readme
Idle Flow Games AdMob
Internal fork of capacitor-community/admob. See internal maintenance and receipt APIs before updating or releasing.
Maintainers
| Maintainer | GitHub | Social | Website | | ------------------- | ------------------------------------------------ | ----------------------------------------------- | ----------------------------------------------- | | Masahiko Sakakibara | rdlabo | @rdlabo | rdlabo.dev | | Saninn Salas Diaz | Saninn Salas Diaz | @SaninnSalas | — |
Maintenance Status: Actively Maintained
Contributors ✨
Made with contributors-img.
Demo
Screenshots
| | Banner | Interstitial | Reward | App Open |
| :---------- | :----------------------------------: | :----------------------------------------: | :----------------------------------: | :---------------------------------: |
| iOS |
|
|
|
|
| Android |
|
|
|
|
Overview
Capacitor community plugin for native AdMob. This plugin wraps the Google Mobile Ads SDK for iOS and Android so you can display banner, interstitial, rewarded, rewarded interstitial, and app open ads in Capacitor apps. It also covers Google User Messaging Platform (UMP) consent and App Tracking Transparency helpers on iOS.
Installation
This plugin already ships Google Mobile Ads SDK. Install the package, then add your AdMob application ID in AndroidManifest / Info.plist. Google's Get started guides for Android and iOS explain app IDs and SKAdNetwork identifiers (Apple's ad conversion IDs); do not add a second Mobile Ads dependency.
@idleflowgames/admob v9 requires Capacitor 8.5.1 or later within 8.x. Plugin version 9 does not target Capacitor 9. It supports iOS 15 or later and Android API 24 or later. See the migration guide and release notes.
npm install @idleflowgames/admob
npx cap syncThis internal fork targets Capacitor 8; use the upstream package for older Capacitor versions.
Google Mobile Ads SDK versions
This major version pins Google Mobile Ads SDK 25.4.0 on Android and 13.9.0 on iOS (Swift Package Manager and CocoaPods). Leave those versions unless you have a specific need. Google's Next-Gen SDK for Android waits until the next plugin major. See Migration for the policy behind the pins.
Android configuration
In android/app/src/main/AndroidManifest.xml, add the following under <application>:
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="@string/admob_app_id" />In android/app/src/main/res/values/strings.xml:
<string name="admob_app_id">[APP_ID]</string>Replace [APP_ID] with your AdMob application ID, not an ad unit ID.
Variables
You can leave these unset. Override them in your app's variables.gradle only when you need a specific artifact version:
| Variable | Artifact | Default |
| ------------------------------ | ------------------------------------------------ | -------- |
| playServicesAdsVersion | com.google.android.gms:play-services-ads | 25.4.+ |
| userMessagingPlatformVersion | com.google.android.ump:user-messaging-platform | 4.0.0 |
| androidxCoreKTXVersion | androidx.core:core-ktx | 1.15.0 |
iOS configuration
Add the following inside the outermost <dict> in ios/App/App/Info.plist:
<key>GADIsAdManagerApp</key>
<true/>
<key>GADApplicationIdentifier</key>
<string>[APP_ID]</string>
<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>cstr6suwn9.skadnetwork</string>
</dict>
</array>
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>Replace [APP_ID] with your AdMob application ID, and describe your actual tracking use in NSUserTrackingUsageDescription.
The SKAdNetworkItems snippet includes Google's own identifier. Add the other IDs from Google's iOS setup guide.
Troubleshooting
If CocoaPods cannot resolve Google-Mobile-Ads-SDK:
[error] Error running update: Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "Google-Mobile-Ads-SDK":Run pod repo update in ios/, then npx cap sync ios again.
First test banner
After installation and platform setup, initialize the SDK, request consent, and show a Google demo banner. Use the platform banner IDs from Testing—do not create your own ad unit for this first check.
Call startAdMob from a user action or after the UI is ready (for example a button or post-navigation hook), not only at module evaluation time.
import { Capacitor } from '@capacitor/core';
import { AdMob, AdmobConsentStatus, BannerAdOptions, BannerAdSize, BannerAdPosition } from '@idleflowgames/admob';
const bannerAdId =
Capacitor.getPlatform() === 'ios'
? 'ca-app-pub-3940256099942544/2934735716'
: 'ca-app-pub-3940256099942544/6300978111';
async function startAdMob() {
await AdMob.initialize();
let consentInfo = await AdMob.requestConsentInfo();
if (consentInfo.isConsentFormAvailable && consentInfo.status === AdmobConsentStatus.REQUIRED) {
consentInfo = await AdMob.showConsentForm();
}
if (!consentInfo.canRequestAds) {
// Consent not ready — no banner is shown.
return;
}
const options: BannerAdOptions = {
adId: bannerAdId,
adSize: BannerAdSize.ADAPTIVE_BANNER,
position: BannerAdPosition.BOTTOM_CENTER,
margin: 0,
};
await AdMob.showBanner(options);
}Expected result: when canRequestAds is true, a Google test banner appears at the bottom of the native screen. When canRequestAds is false, the function returns and no banner is shown. The banner sits above the WebView and can cover HTML—see Banner Ads to inset your layout. Details: Configuration, Consent, and Testing.
Choose by advertising goal
| Goal | Ad format | Guide | | ----------------------------------------------------------------- | ------------------------- | ------------------------------------------ | | Keep an ad visible alongside app content | Banner | Banner Ads | | Show a full-screen ad at a natural break without granting a reward | Interstitial | Interstitial Ads | | Offer a dedicated rewarded experience | Rewarded | Rewarded Ads | | Offer a reward at a natural transition | Rewarded interstitial | Rewarded Ads | | Monetize an app-open experience | App Open | App Open Ads |
Documentation
Start with Installation above, then Configuration and Consent. Run the first test banner, then use Testing for demo units and devices. Pick an ad format from the table above. The same guides are also on the documentation site (English and Japanese). If you opened this README on npm, use that site for the guides — the docs/ files live in the GitHub repository. Method signatures are in the API section below.
- Configuration —
AdMob.initializeand SDK options. - Consent — privacy consent and iOS tracking authorization.
- Testing — demo ad units, test devices, and consent testing.
- Banner Ads — banner options, lifecycle, and events.
- Full-screen ads:
- Interstitial Ads — load, show, and multiple prepared ads.
- Rewarded Ads — rewarded video, rewarded interstitial, and server-side verification.
- App Open Ads — load and present on foreground transitions.
- Ad Events — shared lifecycle events, errors, and revenue data.
- Migration Guide — historical notes when upgrading from older plugin versions.
Index
initialize(...)trackingAuthorizationStatus()requestTrackingAuthorization()setApplicationMuted(...)setApplicationVolume(...)loadAppOpen(...)showAppOpen(...)isAppOpenLoaded(...)addListener(AppOpenAdPluginEvents.Loaded, ...)addListener(AppOpenAdPluginEvents.FailedToLoad, ...)addListener(AppOpenAdPluginEvents.Opened, ...)addListener(AppOpenAdPluginEvents.Closed, ...)addListener(AppOpenAdPluginEvents.FailedToShow, ...)addListener(AppOpenAdPluginEvents.AdImpression, ...)showBanner(...)hideBanner()resumeBanner()removeBanner()addListener(BannerAdPluginEvents.SizeChanged, ...)addListener(BannerAdPluginEvents.Loaded, ...)addListener(BannerAdPluginEvents.FailedToLoad, ...)addListener(BannerAdPluginEvents.Opened, ...)addListener(BannerAdPluginEvents.Closed, ...)addListener(BannerAdPluginEvents.AdImpression, ...)addListener(BannerAdPluginEvents.AdPaid, ...)requestConsentInfo(...)showPrivacyOptionsForm()showConsentForm()resetConsentInfo()prepareInterstitial(...)showInterstitial(...)addListener(InterstitialAdPluginEvents.FailedToLoad, ...)addListener(InterstitialAdPluginEvents.Loaded, ...)addListener(InterstitialAdPluginEvents.Dismissed, ...)addListener(InterstitialAdPluginEvents.FailedToShow, ...)addListener(InterstitialAdPluginEvents.Showed, ...)addListener(InterstitialAdPluginEvents.AdImpression, ...)prepareRewardVideoAd(...)showRewardVideoAd(...)getRewardReceipt()storeRewardReceipt(...)clearRewardReceipt(...)getRunBankRewardReceipt()storeRunBankRewardReceipt(...)clearRunBankRewardReceipt(...)discardOrphanedRunBankRewardReceipt(...)addListener(RewardAdPluginEvents.FailedToLoad, ...)addListener(RewardAdPluginEvents.Loaded, ...)addListener(RewardAdPluginEvents.Rewarded, ...)addListener(RewardAdPluginEvents.Dismissed, ...)addListener(RewardAdPluginEvents.FailedToShow, ...)addListener(RewardAdPluginEvents.Showed, ...)addListener(RewardAdPluginEvents.AdImpression, ...)prepareRewardInterstitialAd(...)showRewardInterstitialAd(...)addListener(RewardInterstitialAdPluginEvents.FailedToLoad, ...)addListener(RewardInterstitialAdPluginEvents.Loaded, ...)addListener(RewardInterstitialAdPluginEvents.Rewarded, ...)addListener(RewardInterstitialAdPluginEvents.Dismissed, ...)addListener(RewardInterstitialAdPluginEvents.FailedToShow, ...)addListener(RewardInterstitialAdPluginEvents.Showed, ...)addListener(RewardInterstitialAdPluginEvents.AdImpression, ...)- Interfaces
- Type Aliases
- Enums
API
initialize(...)
initialize(options?: AdMobInitializationOptions | undefined) => anyInitializes the Google Mobile Ads SDK.
| Param | Type | Description |
| ------------- | --------------------------------------------------------------------------------- | ------------------------------------- |
| options | AdMobInitializationOptions | Optional SDK initialization settings. |
Returns: any
Since: 1.1.2
trackingAuthorizationStatus()
trackingAuthorizationStatus() => anyReturns the current App Tracking Transparency authorization status on iOS 14 and later.
Returns authorized on earlier iOS versions, Android, and web.
Returns: any
Since: 3.1.0
requestTrackingAuthorization()
requestTrackingAuthorization() => anyRequests App Tracking Transparency authorization on iOS 14 and later. Resolves without taking action on earlier iOS versions, Android, and web.
Returns: any
Since: 5.2.0
setApplicationMuted(...)
setApplicationMuted(options: ApplicationMutedOptions) => anyReports whether the application audio is muted to the Google Mobile Ads SDK.
| Param | Type |
| ------------- | --------------------------------------------------------------------------- |
| options | ApplicationMutedOptions |
Returns: any
Since: 4.1.1
setApplicationVolume(...)
setApplicationVolume(options: ApplicationVolumeOptions) => anyReports the application audio volume to the Google Mobile Ads SDK.
| Param | Type |
| ------------- | ----------------------------------------------------------------------------- |
| options | ApplicationVolumeOptions |
Returns: any
Since: 4.1.1
loadAppOpen(...)
loadAppOpen(options: AppOpenAdOptions) => anyLoads an App Open ad and returns the loaded ad unit ID.
| Param | Type |
| ------------- | ------------------------------------------------------------- |
| options | AppOpenAdOptions |
Returns: any
showAppOpen(...)
showAppOpen(options?: AdShowOptions | undefined) => anyShows a loaded App Open ad.
| Param | Type | Description |
| ------------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| options | AdShowOptions | Optional. Pass { adId } to show a specific prepared ad instead of the most recent one. |
Returns: any
isAppOpenLoaded(...)
isAppOpenLoaded(options?: AdShowOptions | undefined) => anyChecks whether an App Open ad is loaded.
| Param | Type | Description |
| ------------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| options | AdShowOptions | Optional. Pass an adId to check a specific prepared ad instead of the most recent one. |
Returns: any
addListener(AppOpenAdPluginEvents.Loaded, ...)
addListener(eventName: AppOpenAdPluginEvents.Loaded, listenerFunc: (info: AdLoadInfo) => void) => anyListens for App Open ad load events.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------ |
| eventName | AppOpenAdPluginEvents.Loaded |
| listenerFunc | (info: AdLoadInfo) => void |
Returns: any
addListener(AppOpenAdPluginEvents.FailedToLoad, ...)
addListener(eventName: AppOpenAdPluginEvents.FailedToLoad, listenerFunc: (error: AdMobError) => void) => anyListens for App Open ad load failures.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------ |
| eventName | AppOpenAdPluginEvents.FailedToLoad |
| listenerFunc | (error: AdMobError) => void |
Returns: any
addListener(AppOpenAdPluginEvents.Opened, ...)
addListener(eventName: AppOpenAdPluginEvents.Opened, listenerFunc: () => void) => anyListens for App Open ad opened events.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------ |
| eventName | AppOpenAdPluginEvents.Opened |
| listenerFunc | () => void |
Returns: any
addListener(AppOpenAdPluginEvents.Closed, ...)
addListener(eventName: AppOpenAdPluginEvents.Closed, listenerFunc: () => void) => anyListens for App Open ad closed events.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------ |
| eventName | AppOpenAdPluginEvents.Closed |
| listenerFunc | () => void |
Returns: any
addListener(AppOpenAdPluginEvents.FailedToShow, ...)
addListener(eventName: AppOpenAdPluginEvents.FailedToShow, listenerFunc: (error: AdMobError) => void) => anyListens for App Open ad show failures.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------ |
| eventName | AppOpenAdPluginEvents.FailedToShow |
| listenerFunc | (error: AdMobError) => void |
Returns: any
addListener(AppOpenAdPluginEvents.AdImpression, ...)
addListener(eventName: AppOpenAdPluginEvents.AdImpression, listenerFunc: (data: AdMobRevenueData) => void) => anyListens for App Open impression-level ad revenue events.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------ |
| eventName | AppOpenAdPluginEvents.AdImpression |
| listenerFunc | (data: AdMobRevenueData) => void |
Returns: any
showBanner(...)
showBanner(options: BannerAdOptions) => anyDisplays a banner ad.
| Param | Type | Description |
| ------------- | ----------------------------------------------------------- | ---------------------------------- |
| options | BannerAdOptions | AdOptions |
Returns: any
Since: 1.1.2
hideBanner()
hideBanner() => anyHides the current banner without destroying it.
Returns: any
Since: 1.1.2
resumeBanner()
resumeBanner() => anyShows a previously hidden banner.
Returns: any
Since: 1.1.2
removeBanner()
removeBanner() => anyDestroys the current banner and removes it from the screen.
Returns: any
Since: 1.1.2
addListener(BannerAdPluginEvents.SizeChanged, ...)
addListener(eventName: BannerAdPluginEvents.SizeChanged, listenerFunc: (info: AdMobBannerSize) => void) => anyListens for changes to the displayed banner dimensions.
| Param | Type | Description |
| ------------------ | --------------------------------------------------------------------------------- | ------------------- |
| eventName | BannerAdPluginEvents.SizeChanged | bannerAdSizeChanged |
| listenerFunc | (info: AdMobBannerSize) => void | |
Returns: any
Since: 3.0.0
addListener(BannerAdPluginEvents.Loaded, ...)
addListener(eventName: BannerAdPluginEvents.Loaded, listenerFunc: () => void) => anyListens for banner ad load events.
| Param | Type | Description |
| ------------------ | ---------------------------------------------------------------------------- | -------------- |
| eventName | BannerAdPluginEvents.Loaded | bannerAdLoaded |
| listenerFunc | () => void | |
Returns: any
Since: 3.0.0
addListener(BannerAdPluginEvents.FailedToLoad, ...)
addListener(eventName: BannerAdPluginEvents.FailedToLoad, listenerFunc: (info: AdMobError) => void) => anyListens for banner ad load failures.
| Param | Type | Description |
| ------------------ | ---------------------------------------------------------------------------------- | -------------------- |
| eventName | BannerAdPluginEvents.FailedToLoad | bannerAdFailedToLoad |
| listenerFunc | (info: AdMobError) => void | |
Returns: any
Since: 3.0.0
addListener(BannerAdPluginEvents.Opened, ...)
addListener(eventName: BannerAdPluginEvents.Opened, listenerFunc: () => void) => anyListens for banner overlay opened events.
| Param | Type | Description |
| ------------------ | ---------------------------------------------------------------------------- | -------------- |
| eventName | BannerAdPluginEvents.Opened | bannerAdOpened |
| listenerFunc | () => void | |
Returns: any
Since: 3.0.0
addListener(BannerAdPluginEvents.Closed, ...)
addListener(eventName: BannerAdPluginEvents.Closed, listenerFunc: () => void) => anyListens for banner overlay closed events.
| Param | Type | Description |
| ------------------ | ---------------------------------------------------------------------------- | -------------- |
| eventName | BannerAdPluginEvents.Closed | bannerAdClosed |
| listenerFunc | () => void | |
Returns: any
Since: 3.0.0
addListener(BannerAdPluginEvents.AdImpression, ...)
addListener(eventName: BannerAdPluginEvents.AdImpression, listenerFunc: () => void) => anyListens for banner impression events.
| Param | Type | Description |
| ------------------ | ---------------------------------------------------------------------------------- | ------------ |
| eventName | BannerAdPluginEvents.AdImpression | AdImpression |
| listenerFunc | () => void | |
Returns: any
Since: 3.0.0
addListener(BannerAdPluginEvents.AdPaid, ...)
addListener(eventName: BannerAdPluginEvents.AdPaid, listenerFunc: (data: AdMobRevenueData) => void) => anyListens for banner impression-level ad revenue events.
| Param | Type |
| ------------------ | -------------------------------------------------------------------------------- |
| eventName | BannerAdPluginEvents.AdPaid |
| listenerFunc | (data: AdMobRevenueData) => void |
Returns: any
requestConsentInfo(...)
requestConsentInfo(options?: AdmobConsentRequestOptions | undefined) => anyRequest user consent information
| Param | Type | Description |
| ------------- | --------------------------------------------------------------------------------- | --------------------- |
| options | AdmobConsentRequestOptions | ConsentRequestOptions |
Returns: any
Since: 5.0.0
showPrivacyOptionsForm()
showPrivacyOptionsForm() => anyShows a google privacy options form (rendered from your GDPR message config).
Returns: any
Since: 7.0.3
showConsentForm()
showConsentForm() => anyShows a google user consent form (rendered from your GDPR message config).
Returns: any
Since: 5.0.0
resetConsentInfo()
resetConsentInfo() => anyResets the UMP SDK state. Call requestConsentInfo function again to allow user modify their consent
Returns: any
Since: 5.0.0
prepareInterstitial(...)
prepareInterstitial(options: AdOptions) => anyLoads an interstitial ad and returns the loaded ad unit ID.
| Param | Type | Description |
| ------------- | ----------------------------------------------- | ---------------------------------- |
| options | AdOptions | AdOptions |
Returns: any
Since: 1.1.2
showInterstitial(...)
showInterstitial(options?: AdShowOptions | undefined) => anyShows a loaded interstitial ad.
| Param | Type | Description |
| ------------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| options | AdShowOptions | Optional. Pass { adId } to show a specific prepared ad instead of the most recent one. |
Returns: any
Since: 1.1.2
addListener(InterstitialAdPluginEvents.FailedToLoad, ...)
addListener(eventName: InterstitialAdPluginEvents.FailedToLoad, listenerFunc: (error: AdMobError) => void) => anyListens for interstitial ad load failures.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------- |
| eventName | InterstitialAdPluginEvents.FailedToLoad |
| listenerFunc | (error: AdMobError) => void |
Returns: any
addListener(InterstitialAdPluginEvents.Loaded, ...)
addListener(eventName: InterstitialAdPluginEvents.Loaded, listenerFunc: (info: AdLoadInfo) => void) => anyListens for interstitial ad load events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------- |
| eventName | InterstitialAdPluginEvents.Loaded |
| listenerFunc | (info: AdLoadInfo) => void |
Returns: any
addListener(InterstitialAdPluginEvents.Dismissed, ...)
addListener(eventName: InterstitialAdPluginEvents.Dismissed, listenerFunc: () => void) => anyListens for interstitial ad dismissed events.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------------- |
| eventName | InterstitialAdPluginEvents.Dismissed |
| listenerFunc | () => void |
Returns: any
addListener(InterstitialAdPluginEvents.FailedToShow, ...)
addListener(eventName: InterstitialAdPluginEvents.FailedToShow, listenerFunc: (error: AdMobError) => void) => anyListens for interstitial ad show failures.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------- |
| eventName | InterstitialAdPluginEvents.FailedToShow |
| listenerFunc | (error: AdMobError) => void |
Returns: any
addListener(InterstitialAdPluginEvents.Showed, ...)
addListener(eventName: InterstitialAdPluginEvents.Showed, listenerFunc: () => void) => anyListens for interstitial ad shown events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------- |
| eventName | InterstitialAdPluginEvents.Showed |
| listenerFunc | () => void |
Returns: any
addListener(InterstitialAdPluginEvents.AdImpression, ...)
addListener(eventName: InterstitialAdPluginEvents.AdImpression, listenerFunc: (data: AdMobRevenueData) => void) => anyListens for interstitial impression-level ad revenue events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------- |
| eventName | InterstitialAdPluginEvents.AdImpression |
| listenerFunc | (data: AdMobRevenueData) => void |
Returns: any
prepareRewardVideoAd(...)
prepareRewardVideoAd(options: RewardAdOptions) => anyLoads a rewarded ad and returns the loaded ad unit ID.
| Param | Type | Description |
| ------------- | ----------------------------------------------------------- | ---------------------------------------------- |
| options | RewardAdOptions | RewardAdOptions |
Returns: any
Since: 1.1.2
showRewardVideoAd(...)
showRewardVideoAd(options?: RewardVideoShowOptions | undefined) => anyShows a loaded rewarded ad and resolves when the user earns the reward.
| Param | Type | Description |
| ------------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| options | RewardVideoShowOptions | Optional. Pass { adId } to show a specific prepared ad instead of the most recent one. |
Returns: any
Since: 1.1.2
getRewardReceipt()
getRewardReceipt() => anyRead the bounded native Welcome Back receipt queue without initializing ads.
Returns: any
storeRewardReceipt(...)
storeRewardReceipt(options: { rewardReceipt: StoredWelcomeBackRewardReceipt; }) => anyStore an earned entitlement/dev receipt synchronously on the native side.
| Param | Type |
| ------------- | ------------------------------------------------------------------------------------------------------------- |
| options | { rewardReceipt: StoredWelcomeBackRewardReceipt; } |
Returns: any
clearRewardReceipt(...)
clearRewardReceipt(options: { mode: "exact"; expectedReceipt: StoredWelcomeBackRewardReceipt; } | { mode: "malformed_only" | "reset_all"; }) => anyAtomically compare-and-clear exact evidence, salvage malformed siblings, or reset all.
| Param | Type |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| options | { mode: 'exact'; expectedReceipt: StoredWelcomeBackRewardReceipt; } | { mode: 'malformed_only' | 'reset_all'; } |
Returns: any
getRunBankRewardReceipt()
getRunBankRewardReceipt() => anyRead the isolated Android Run-bank X2 receipt queue.
Returns: any
storeRunBankRewardReceipt(...)
storeRunBankRewardReceipt(options: { runBankRewardReceipt: StoredRunBankRewardReceipt; }) => anyStore one exact pending/earned/consumed Run-bank X2 receipt.
| Param | Type |
| ------------- | ------------------------------------------------------------------------------------------------------------ |
| options | { runBankRewardReceipt: StoredRunBankRewardReceipt; } |
Returns: any
clearRunBankRewardReceipt(...)
clearRunBankRewardReceipt(options: { mode: "exact"; expectedReceipt: StoredRunBankRewardReceipt & { status: "pending" | "consumed"; }; } | { mode: "reset_all"; }) => anyAtomically compare-clear an exact Run-bank receipt, or reset all.
| Param | Type |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| options | { mode: 'exact'; expectedReceipt: StoredRunBankRewardReceipt & { status: 'pending' | 'consumed'; }; } | { mode: 'reset_all'; } |
Returns: any
discardOrphanedRunBankRewardReceipt(...)
discardOrphanedRunBankRewardReceipt(options: { expectedReceipt: StoredRunBankRewardReceipt & { status: "pending"; }; }) => anyClear an exact pending receipt only when no callback in this Android process owns it.
| Param | Type |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| options | { expectedReceipt: StoredRunBankRewardReceipt & { status: 'pending'; }; } |
Returns: any
addListener(RewardAdPluginEvents.FailedToLoad, ...)
addListener(eventName: RewardAdPluginEvents.FailedToLoad, listenerFunc: (error: AdMobError) => void) => anyListens for rewarded ad load failures.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------- |
| eventName | RewardAdPluginEvents.FailedToLoad |
| listenerFunc | (error: AdMobError) => void |
Returns: any
addListener(RewardAdPluginEvents.Loaded, ...)
addListener(eventName: RewardAdPluginEvents.Loaded, listenerFunc: (info: AdLoadInfo) => void) => anyListens for rewarded ad load events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------- |
| eventName | RewardAdPluginEvents.Loaded |
| listenerFunc | (info: AdLoadInfo) => void |
Returns: any
addListener(RewardAdPluginEvents.Rewarded, ...)
addListener(eventName: RewardAdPluginEvents.Rewarded, listenerFunc: (reward: AdMobRewardItem) => void) => anyListens for earned reward events.
| Param | Type |
| ------------------ | -------------------------------------------------------------------------------- |
| eventName | RewardAdPluginEvents.Rewarded |
| listenerFunc | (reward: AdMobRewardItem) => void |
Returns: any
addListener(RewardAdPluginEvents.Dismissed, ...)
addListener(eventName: RewardAdPluginEvents.Dismissed, listenerFunc: () => void) => anyListens for rewarded ad dismissed events.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------- |
| eventName | RewardAdPluginEvents.Dismissed |
| listenerFunc | () => void |
Returns: any
addListener(RewardAdPluginEvents.FailedToShow, ...)
addListener(eventName: RewardAdPluginEvents.FailedToShow, listenerFunc: (error: AdMobError) => void) => anyListens for rewarded ad show failures.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------- |
| eventName | RewardAdPluginEvents.FailedToShow |
| listenerFunc | (error: AdMobError) => void |
Returns: any
addListener(RewardAdPluginEvents.Showed, ...)
addListener(eventName: RewardAdPluginEvents.Showed, listenerFunc: () => void) => anyListens for rewarded ad shown events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------- |
| eventName | RewardAdPluginEvents.Showed |
| listenerFunc | () => void |
Returns: any
addListener(RewardAdPluginEvents.AdImpression, ...)
addListener(eventName: RewardAdPluginEvents.AdImpression, listenerFunc: (data: AdMobRevenueData) => void) => anyListens for rewarded impression-level ad revenue events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------- |
| eventName | RewardAdPluginEvents.AdImpression |
| listenerFunc | (data: AdMobRevenueData) => void |
Returns: any
prepareRewardInterstitialAd(...)
prepareRewardInterstitialAd(options: RewardInterstitialAdOptions) => anyLoads a rewarded interstitial ad and returns the loaded ad unit ID.
| Param | Type | Description |
| ------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| options | RewardInterstitialAdOptions | RewardInterstitialAdOptions |
Returns: any
Since: 1.1.2
showRewardInterstitialAd(...)
showRewardInterstitialAd(options?: AdShowOptions | undefined) => anyShows a loaded rewarded interstitial ad and resolves when the user earns the reward.
| Param | Type | Description |
| ------------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| options | AdShowOptions | Optional. Pass { adId } to show a specific prepared ad instead of the most recent one. |
Returns: any
Since: 1.1.2
addListener(RewardInterstitialAdPluginEvents.FailedToLoad, ...)
addListener(eventName: RewardInterstitialAdPluginEvents.FailedToLoad, listenerFunc: (error: AdMobError) => void) => anyListens for rewarded interstitial ad load failures.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------------- |
| eventName | RewardInterstitialAdPluginEvents.FailedToLoad |
| listenerFunc | (error: AdMobError) => void |
Returns: any
addListener(RewardInterstitialAdPluginEvents.Loaded, ...)
addListener(eventName: RewardInterstitialAdPluginEvents.Loaded, listenerFunc: (info: AdLoadInfo) => void) => anyListens for rewarded interstitial ad load events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------- |
| eventName | RewardInterstitialAdPluginEvents.Loaded |
| listenerFunc | (info: AdLoadInfo) => void |
Returns: any
addListener(RewardInterstitialAdPluginEvents.Rewarded, ...)
addListener(eventName: RewardInterstitialAdPluginEvents.Rewarded, listenerFunc: (reward: AdMobRewardInterstitialItem) => void) => anyListens for earned reward events.
| Param | Type |
| ------------------ | -------------------------------------------------------------------------------------------------------- |
| eventName | RewardInterstitialAdPluginEvents.Rewarded |
| listenerFunc | (reward: AdMobRewardInterstitialItem) => void |
Returns: any
addListener(RewardInterstitialAdPluginEvents.Dismissed, ...)
addListener(eventName: RewardInterstitialAdPluginEvents.Dismissed, listenerFunc: () => void) => anyListens for rewarded interstitial ad dismissed events.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------------------------- |
| eventName | RewardInterstitialAdPluginEvents.Dismissed |
| listenerFunc | () => void |
Returns: any
addListener(RewardInterstitialAdPluginEvents.FailedToShow, ...)
addListener(eventName: RewardInterstitialAdPluginEvents.FailedToShow, listenerFunc: (error: AdMobError) => void) => anyListens for rewarded interstitial ad show failures.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------------- |
| eventName | RewardInterstitialAdPluginEvents.FailedToShow |
| listenerFunc | (error: AdMobError) => void |
Returns: any
addListener(RewardInterstitialAdPluginEvents.Showed, ...)
addListener(eventName: RewardInterstitialAdPluginEvents.Showed, listenerFunc: () => void) => anyListens for rewarded interstitial ad shown events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------- |
| eventName | RewardInterstitialAdPluginEvents.Showed |
| listenerFunc | () => void |
Returns: any
addListener(RewardInterstitialAdPluginEvents.AdImpression, ...)
addListener(eventName: RewardInterstitialAdPluginEvents.AdImpression, listenerFunc: (data: AdMobRevenueData) => void) => anyListens for rewarded interstitial impression-level ad revenue events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------------- |
| eventName | RewardInterstitialAdPluginEvents.AdImpression |
| listenerFunc | (data: AdMobRevenueData) => void |
Returns: any
Interfaces
AdMobInitializationOptions
| Prop | Type | Description | Default | Since |
| ---------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
| testingDevices | {} | Device IDs to register as test devices when {@link AdMobInitializationOptions.initializeForTesting} is true. Requests from registered devices receive test ads and do not generate invalid traffic. | | 1.2.0 |
| initializeForTesting | boolean | Whether to register {@link AdMobInitializationOptions.testingDevices} as test devices. | false | 1.2.0 |
| tagForChildDirectedTreatment | boolean | For purposes of the Children's Online Privacy Protection Act (COPPA), there is a setting called tagForChildDirectedTreatment. | | 3.1.0 |
| tagForUnderAgeOfConsent | boolean | When using this feature, a Tag For Users under the Age of Consent in Europe (TFUA) parameter will be included in all future ad requests. | | 3.1.0 |
| maxAdContentRating | MaxAdContentRating | The maximum ad content rating applied to all ad requests. Ads with a higher rating are excluded. | | 3.1.0 |
TrackingAuthorizationStatusInterface
The current iOS App Tracking Transparency authorization status.
| Prop | Type | Description |
| ------------ | ------------------------------------------------------------------------ | --------------------------------------------------------------- |
| status | 'authorized' | 'denied' | 'notDetermined' | 'restricted' | The authorization status reported by App Tracking Transparency. |
ApplicationMutedOptions
| Prop | Type | Description | Since |
| ----------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| muted | boolean | To inform the SDK that the app volume has been muted. Note: Video ads that are ineligible to be shown with muted audio are not returned for ad requests made, when the app volume is reported as muted or set to a value of 0. This may restrict a subset of the broader video ads pool from serving. | 4.1.1 |
ApplicationVolumeOptions
| Prop | Type | Description | Since |
| ------------ | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| volume | 0 | 1 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | If your app has its own volume controls (such as custom music or sound effect volumes), disclosing app volume to the Google Mobile Ads SDK allows video ads to respect app volume settings. Use a supported value from 0.0 (silent) to 1.0 (full volume). | 4.1.1 |
AppOpenAdOptions
Options for loading an App Open ad.
| Prop | Type | Description |
| ---------- | ------------------- | -------------------------------- |
| adId | string | The App Open ad unit ID to load. |
AdLoadInfo
Information returned after an ad loads successfully.
| Prop | Type | Description |
| -------------- | ------------------- | -------------------------------- |
| adUnitId | string | The ad unit ID of the loaded ad. |
AdShowOptions
Options for selecting a previously loaded ad to show or inspect.
| Prop | Type | Description | Since |
| ---------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------- | ----- |
| adId | string | The ad unit ID of a previously prepared ad to target. If omitted, the operation targets the most recently prepared ad. | 8.0.1 |
PluginListenerHandle
| Prop | Type |
| ------------ | ------------------------- |
| remove | () => any |
AdMobError
An error returned by the Google Mobile Ads SDK.
| Prop | Type | Description |
| ------------- | ------------------- | -------------------------------------- |
| code | number | Gets the error's code. |
| message | string | Gets the message describing the error. |
AdMobRevenueData
Impression-level ad revenue data emitted by a paid event.
| Prop | Type | Description |
| ------------------ | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| adUnitId | string | The ad unit ID associated with the paid event. |
| valueMicros | number | The ad value in micros, where 1,000,000 micros equals one currency unit. |
| currencyCode | string | The ISO 4217 currency code for valueMicros. |
| precision | AdValuePrecision | The precision of the reported ad value.
