@capacitor-community/admob
v8.2.1
Published
A native plugin for AdMob
Maintainers
Readme
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.
This plugin targets @capacitor-community/admob v8.2.0 and Capacitor 8.5 or later (within v8). It supports iOS 15 or later and Android API 24 or later.
npm install @capacitor-community/admob
npx cap syncIf you still use Capacitor 7, install @capacitor-community/admob@7.
Google Mobile Ads SDK versions
This major version pins Google Mobile Ads SDK 25.4.x on Android and 13.11.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, request consent, initialize the SDK when ads may be requested, 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 '@capacitor-community/admob';
const bannerAdId =
Capacitor.getPlatform() === 'ios'
? 'ca-app-pub-3940256099942544/2934735716'
: 'ca-app-pub-3940256099942544/6300978111';
async function startAdMob() {
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;
}
await AdMob.initialize();
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 are also included in the package. 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.
- Native Ads (Preview) — available for testing and production use. Its API may change in a minor release while in Preview.
- 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 — upgrade steps and behavior changes in v8.2.0 and earlier 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(...)addListener(RewardAdPluginEvents.adClicked, ...)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) => Promise<void>Initializes the Google Mobile Ads SDK.
| Param | Type | Description |
| ------------- | --------------------------------------------------------------------------------- | ------------------------------------- |
| options | AdMobInitializationOptions | Optional SDK initialization settings. |
Since: 1.1.2
trackingAuthorizationStatus()
trackingAuthorizationStatus() => Promise<TrackingAuthorizationStatusInterface>Returns the current App Tracking Transparency authorization status on iOS 14 and later.
Returns authorized on earlier iOS versions, Android, and web.
Returns: Promise<TrackingAuthorizationStatusInterface>
Since: 3.1.0
requestTrackingAuthorization()
requestTrackingAuthorization() => Promise<void>Requests App Tracking Transparency authorization on iOS 14 and later. Resolves without taking action on earlier iOS versions, Android, and web.
Since: 5.2.0
setApplicationMuted(...)
setApplicationMuted(options: ApplicationMutedOptions) => Promise<void>Reports whether the application audio is muted to the Google Mobile Ads SDK.
| Param | Type |
| ------------- | --------------------------------------------------------------------------- |
| options | ApplicationMutedOptions |
Since: 4.1.1
setApplicationVolume(...)
setApplicationVolume(options: ApplicationVolumeOptions) => Promise<void>Reports the application audio volume to the Google Mobile Ads SDK.
| Param | Type |
| ------------- | ----------------------------------------------------------------------------- |
| options | ApplicationVolumeOptions |
Since: 4.1.1
loadAppOpen(...)
loadAppOpen(options: AppOpenAdOptions) => Promise<AdLoadInfo>Loads an App Open ad and returns the loaded ad unit ID.
| Param | Type |
| ------------- | ------------------------------------------------------------- |
| options | AppOpenAdOptions |
Returns: Promise<AdLoadInfo>
showAppOpen(...)
showAppOpen(options?: AdShowOptions | undefined) => Promise<void>Shows 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. |
isAppOpenLoaded(...)
isAppOpenLoaded(options?: AdShowOptions | undefined) => Promise<{ value: boolean; }>Checks 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: Promise<{ value: boolean; }>
addListener(AppOpenAdPluginEvents.Loaded, ...)
addListener(eventName: AppOpenAdPluginEvents.Loaded, listenerFunc: (info: AdLoadInfo) => void) => Promise<PluginListenerHandle>Listens for App Open ad load events.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------ |
| eventName | AppOpenAdPluginEvents.Loaded |
| listenerFunc | (info: AdLoadInfo) => void |
Returns: Promise<PluginListenerHandle>
addListener(AppOpenAdPluginEvents.FailedToLoad, ...)
addListener(eventName: AppOpenAdPluginEvents.FailedToLoad, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>Listens for App Open ad load failures.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------ |
| eventName | AppOpenAdPluginEvents.FailedToLoad |
| listenerFunc | (error: AdMobError) => void |
Returns: Promise<PluginListenerHandle>
addListener(AppOpenAdPluginEvents.Opened, ...)
addListener(eventName: AppOpenAdPluginEvents.Opened, listenerFunc: () => void) => Promise<PluginListenerHandle>Listens for App Open ad opened events.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------ |
| eventName | AppOpenAdPluginEvents.Opened |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
addListener(AppOpenAdPluginEvents.Closed, ...)
addListener(eventName: AppOpenAdPluginEvents.Closed, listenerFunc: () => void) => Promise<PluginListenerHandle>Listens for App Open ad closed events.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------ |
| eventName | AppOpenAdPluginEvents.Closed |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
addListener(AppOpenAdPluginEvents.FailedToShow, ...)
addListener(eventName: AppOpenAdPluginEvents.FailedToShow, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>Listens for App Open ad show failures.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------ |
| eventName | AppOpenAdPluginEvents.FailedToShow |
| listenerFunc | (error: AdMobError) => void |
Returns: Promise<PluginListenerHandle>
addListener(AppOpenAdPluginEvents.AdImpression, ...)
addListener(eventName: AppOpenAdPluginEvents.AdImpression, listenerFunc: (data: AdMobRevenueData) => void) => Promise<PluginListenerHandle>Listens for App Open impression-level ad revenue events.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------ |
| eventName | AppOpenAdPluginEvents.AdImpression |
| listenerFunc | (data: AdMobRevenueData) => void |
Returns: Promise<PluginListenerHandle>
showBanner(...)
showBanner(options: BannerAdOptions) => Promise<void>Displays a banner ad.
| Param | Type | Description |
| ------------- | ----------------------------------------------------------- | ---------------------------------- |
| options | BannerAdOptions | AdOptions |
Since: 1.1.2
hideBanner()
hideBanner() => Promise<void>Hides the current banner without destroying it.
Since: 1.1.2
resumeBanner()
resumeBanner() => Promise<void>Shows a previously hidden banner.
Since: 1.1.2
removeBanner()
removeBanner() => Promise<void>Destroys the current banner and removes it from the screen.
Since: 1.1.2
addListener(BannerAdPluginEvents.SizeChanged, ...)
addListener(eventName: BannerAdPluginEvents.SizeChanged, listenerFunc: (info: AdMobBannerSize) => void) => Promise<PluginListenerHandle>Listens for changes to the displayed banner dimensions.
| Param | Type | Description |
| ------------------ | --------------------------------------------------------------------------------- | ------------------- |
| eventName | BannerAdPluginEvents.SizeChanged | bannerAdSizeChanged |
| listenerFunc | (info: AdMobBannerSize) => void | |
Returns: Promise<PluginListenerHandle>
Since: 3.0.0
addListener(BannerAdPluginEvents.Loaded, ...)
addListener(eventName: BannerAdPluginEvents.Loaded, listenerFunc: () => void) => Promise<PluginListenerHandle>Listens for banner ad load events.
| Param | Type | Description |
| ------------------ | ---------------------------------------------------------------------------- | -------------- |
| eventName | BannerAdPluginEvents.Loaded | bannerAdLoaded |
| listenerFunc | () => void | |
Returns: Promise<PluginListenerHandle>
Since: 3.0.0
addListener(BannerAdPluginEvents.FailedToLoad, ...)
addListener(eventName: BannerAdPluginEvents.FailedToLoad, listenerFunc: (info: AdMobError) => void) => Promise<PluginListenerHandle>Listens for banner ad load failures.
| Param | Type | Description |
| ------------------ | ---------------------------------------------------------------------------------- | -------------------- |
| eventName | BannerAdPluginEvents.FailedToLoad | bannerAdFailedToLoad |
| listenerFunc | (info: AdMobError) => void | |
Returns: Promise<PluginListenerHandle>
Since: 3.0.0
addListener(BannerAdPluginEvents.Opened, ...)
addListener(eventName: BannerAdPluginEvents.Opened, listenerFunc: () => void) => Promise<PluginListenerHandle>Listens for banner overlay opened events.
| Param | Type | Description |
| ------------------ | ---------------------------------------------------------------------------- | -------------- |
| eventName | BannerAdPluginEvents.Opened | bannerAdOpened |
| listenerFunc | () => void | |
Returns: Promise<PluginListenerHandle>
Since: 3.0.0
addListener(BannerAdPluginEvents.Closed, ...)
addListener(eventName: BannerAdPluginEvents.Closed, listenerFunc: () => void) => Promise<PluginListenerHandle>Listens for banner overlay closed events.
| Param | Type | Description |
| ------------------ | ---------------------------------------------------------------------------- | -------------- |
| eventName | BannerAdPluginEvents.Closed | bannerAdClosed |
| listenerFunc | () => void | |
Returns: Promise<PluginListenerHandle>
Since: 3.0.0
addListener(BannerAdPluginEvents.AdImpression, ...)
addListener(eventName: BannerAdPluginEvents.AdImpression, listenerFunc: () => void) => Promise<PluginListenerHandle>Listens for banner impression events.
| Param | Type | Description |
| ------------------ | ---------------------------------------------------------------------------------- | ------------ |
| eventName | BannerAdPluginEvents.AdImpression | AdImpression |
| listenerFunc | () => void | |
Returns: Promise<PluginListenerHandle>
Since: 3.0.0
addListener(BannerAdPluginEvents.AdPaid, ...)
addListener(eventName: BannerAdPluginEvents.AdPaid, listenerFunc: (data: AdMobRevenueData) => void) => Promise<PluginListenerHandle>Listens for banner impression-level ad revenue events.
| Param | Type |
| ------------------ | -------------------------------------------------------------------------------- |
| eventName | BannerAdPluginEvents.AdPaid |
| listenerFunc | (data: AdMobRevenueData) => void |
Returns: Promise<PluginListenerHandle>
requestConsentInfo(...)
requestConsentInfo(options?: AdmobConsentRequestOptions | undefined) => Promise<AdmobConsentInfo>Request user consent information
| Param | Type | Description |
| ------------- | --------------------------------------------------------------------------------- | --------------------- |
| options | AdmobConsentRequestOptions | ConsentRequestOptions |
Returns: Promise<AdmobConsentInfo>
Since: 5.0.0
showPrivacyOptionsForm()
showPrivacyOptionsForm() => Promise<void>Shows a google privacy options form (rendered from your GDPR message config).
Since: 7.0.3
showConsentForm()
showConsentForm() => Promise<AdmobConsentInfo>Shows a google user consent form (rendered from your GDPR message config).
Returns: Promise<AdmobConsentInfo>
Since: 5.0.0
resetConsentInfo()
resetConsentInfo() => Promise<void>Resets the UMP SDK state. Call requestConsentInfo function again to allow user modify their consent
Since: 5.0.0
prepareInterstitial(...)
prepareInterstitial(options: AdOptions) => Promise<AdLoadInfo>Loads an interstitial ad and returns the loaded ad unit ID.
SDK load failures reject with the native error message and a string code.
Codes are platform-specific; FailedToLoad events expose the same code as a number.
| Param | Type | Description |
| ------------- | ----------------------------------------------- | ---------------------------------- |
| options | AdOptions | AdOptions |
Returns: Promise<AdLoadInfo>
Since: 1.1.2
showInterstitial(...)
showInterstitial(options?: AdShowOptions | undefined) => Promise<void>Shows a loaded interstitial ad.
| Param | Type | Description |
| ------------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| options | AdShowOptions | Optional. Pass { adId } to show a specific prepared ad instead of the most recent one. |
Since: 1.1.2
addListener(InterstitialAdPluginEvents.FailedToLoad, ...)
addListener(eventName: InterstitialAdPluginEvents.FailedToLoad, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>Listens for interstitial ad load failures.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------- |
| eventName | InterstitialAdPluginEvents.FailedToLoad |
| listenerFunc | (error: AdMobError) => void |
Returns: Promise<PluginListenerHandle>
addListener(InterstitialAdPluginEvents.Loaded, ...)
addListener(eventName: InterstitialAdPluginEvents.Loaded, listenerFunc: (info: AdLoadInfo) => void) => Promise<PluginListenerHandle>Listens for interstitial ad load events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------- |
| eventName | InterstitialAdPluginEvents.Loaded |
| listenerFunc | (info: AdLoadInfo) => void |
Returns: Promise<PluginListenerHandle>
addListener(InterstitialAdPluginEvents.Dismissed, ...)
addListener(eventName: InterstitialAdPluginEvents.Dismissed, listenerFunc: () => void) => Promise<PluginListenerHandle>Listens for interstitial ad dismissed events.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------------- |
| eventName | InterstitialAdPluginEvents.Dismissed |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
addListener(InterstitialAdPluginEvents.FailedToShow, ...)
addListener(eventName: InterstitialAdPluginEvents.FailedToShow, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>Listens for interstitial ad show failures.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------- |
| eventName | InterstitialAdPluginEvents.FailedToShow |
| listenerFunc | (error: AdMobError) => void |
Returns: Promise<PluginListenerHandle>
addListener(InterstitialAdPluginEvents.Showed, ...)
addListener(eventName: InterstitialAdPluginEvents.Showed, listenerFunc: () => void) => Promise<PluginListenerHandle>Listens for interstitial ad shown events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------- |
| eventName | InterstitialAdPluginEvents.Showed |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
addListener(InterstitialAdPluginEvents.AdImpression, ...)
addListener(eventName: InterstitialAdPluginEvents.AdImpression, listenerFunc: (data: AdMobRevenueData) => void) => Promise<PluginListenerHandle>Listens for interstitial impression-level ad revenue events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------- |
| eventName | InterstitialAdPluginEvents.AdImpression |
| listenerFunc | (data: AdMobRevenueData) => void |
Returns: Promise<PluginListenerHandle>
prepareRewardVideoAd(...)
prepareRewardVideoAd(options: RewardAdOptions) => Promise<AdLoadInfo>Loads a rewarded ad and returns the loaded ad unit ID.
SDK load failures reject with the native error message and a string code.
Codes are platform-specific; FailedToLoad events expose the same code as a number.
| Param | Type | Description |
| ------------- | ----------------------------------------------------------- | ---------------------------------------------- |
| options | RewardAdOptions | RewardAdOptions |
Returns: Promise<AdLoadInfo>
Since: 1.1.2
showRewardVideoAd(...)
showRewardVideoAd(options?: AdShowOptions | undefined) => Promise<AdMobRewardItem>Shows a loaded rewarded 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: Promise<AdMobRewardItem>
Since: 1.1.2
addListener(RewardAdPluginEvents.adClicked, ...)
addListener(eventName: RewardAdPluginEvents.adClicked, listenerFunc: () => void) => Promise<PluginListenerHandle>Listens for clicks recorded by the rewarded ad SDK, including after a reward is earned. A click does not indicate that the user earned a reward.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------- |
| eventName | RewardAdPluginEvents.adClicked |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
addListener(RewardAdPluginEvents.FailedToLoad, ...)
addListener(eventName: RewardAdPluginEvents.FailedToLoad, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>Listens for rewarded ad load failures.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------- |
| eventName | RewardAdPluginEvents.FailedToLoad |
| listenerFunc | (error: AdMobError) => void |
Returns: Promise<PluginListenerHandle>
addListener(RewardAdPluginEvents.Loaded, ...)
addListener(eventName: RewardAdPluginEvents.Loaded, listenerFunc: (info: AdLoadInfo) => void) => Promise<PluginListenerHandle>Listens for rewarded ad load events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------- |
| eventName | RewardAdPluginEvents.Loaded |
| listenerFunc | (info: AdLoadInfo) => void |
Returns: Promise<PluginListenerHandle>
addListener(RewardAdPluginEvents.Rewarded, ...)
addListener(eventName: RewardAdPluginEvents.Rewarded, listenerFunc: (reward: AdMobRewardItem) => void) => Promise<PluginListenerHandle>Listens for earned reward events.
| Param | Type |
| ------------------ | -------------------------------------------------------------------------------- |
| eventName | RewardAdPluginEvents.Rewarded |
| listenerFunc | (reward: AdMobRewardItem) => void |
Returns: Promise<PluginListenerHandle>
addListener(RewardAdPluginEvents.Dismissed, ...)
addListener(eventName: RewardAdPluginEvents.Dismissed, listenerFunc: () => void) => Promise<PluginListenerHandle>Listens for rewarded ad dismissed events.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------- |
| eventName | RewardAdPluginEvents.Dismissed |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
addListener(RewardAdPluginEvents.FailedToShow, ...)
addListener(eventName: RewardAdPluginEvents.FailedToShow, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>Listens for rewarded ad show failures.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------- |
| eventName | RewardAdPluginEvents.FailedToShow |
| listenerFunc | (error: AdMobError) => void |
Returns: Promise<PluginListenerHandle>
addListener(RewardAdPluginEvents.Showed, ...)
addListener(eventName: RewardAdPluginEvents.Showed, listenerFunc: () => void) => Promise<PluginListenerHandle>Listens for rewarded ad shown events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------- |
| eventName | RewardAdPluginEvents.Showed |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
addListener(RewardAdPluginEvents.AdImpression, ...)
addListener(eventName: RewardAdPluginEvents.AdImpression, listenerFunc: (data: AdMobRevenueData) => void) => Promise<PluginListenerHandle>Listens for rewarded impression-level ad revenue events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------- |
| eventName | RewardAdPluginEvents.AdImpression |
| listenerFunc | (data: AdMobRevenueData) => void |
Returns: Promise<PluginListenerHandle>
prepareRewardInterstitialAd(...)
prepareRewardInterstitialAd(options: RewardInterstitialAdOptions) => Promise<AdLoadInfo>Loads a rewarded interstitial ad and returns the loaded ad unit ID.
SDK load failures reject with the native error message and a string code.
Codes are platform-specific; FailedToLoad events expose the same code as a number.
| Param | Type | Description |
| ------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| options | RewardInterstitialAdOptions | RewardInterstitialAdOptions |
Returns: Promise<AdLoadInfo>
Since: 1.1.2
showRewardInterstitialAd(...)
showRewardInterstitialAd(options?: AdShowOptions | undefined) => Promise<AdMobRewardInterstitialItem>Shows 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: Promise<AdMobRewardInterstitialItem>
Since: 1.1.2
addListener(RewardInterstitialAdPluginEvents.FailedToLoad, ...)
addListener(eventName: RewardInterstitialAdPluginEvents.FailedToLoad, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>Listens for rewarded interstitial ad load failures.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------------- |
| eventName | RewardInterstitialAdPluginEvents.FailedToLoad |
| listenerFunc | (error: AdMobError) => void |
Returns: Promise<PluginListenerHandle>
addListener(RewardInterstitialAdPluginEvents.Loaded, ...)
addListener(eventName: RewardInterstitialAdPluginEvents.Loaded, listenerFunc: (info: AdLoadInfo) => void) => Promise<PluginListenerHandle>Listens for rewarded interstitial ad load events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------- |
| eventName | RewardInterstitialAdPluginEvents.Loaded |
| listenerFunc | (info: AdLoadInfo) => void |
Returns: Promise<PluginListenerHandle>
addListener(RewardInterstitialAdPluginEvents.Rewarded, ...)
addListener(eventName: RewardInterstitialAdPluginEvents.Rewarded, listenerFunc: (reward: AdMobRewardInterstitialItem) => void) => Promise<PluginListenerHandle>Listens for earned reward events.
| Param | Type |
| ------------------ | -------------------------------------------------------------------------------------------------------- |
| eventName | RewardInterstitialAdPluginEvents.Rewarded |
| listenerFunc | (reward: AdMobRewardInterstitialItem) => void |
Returns: Promise<PluginListenerHandle>
addListener(RewardInterstitialAdPluginEvents.Dismissed, ...)
addListener(eventName: RewardInterstitialAdPluginEvents.Dismissed, listenerFunc: () => void) => Promise<PluginListenerHandle>Listens for rewarded interstitial ad dismissed events.
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------------------------- |
| eventName | RewardInterstitialAdPluginEvents.Dismissed |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
addListener(RewardInterstitialAdPluginEvents.FailedToShow, ...)
addListener(eventName: RewardInterstitialAdPluginEvents.FailedToShow, listenerFunc: (error: AdMobError) => void) => Promise<PluginListenerHandle>Listens for rewarded interstitial ad show failures.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------------- |
| eventName | RewardInterstitialAdPluginEvents.FailedToShow |
| listenerFunc | (error: AdMobError) => void |
Returns: Promise<PluginListenerHandle>
addListener(RewardInterstitialAdPluginEvents.Showed, ...)
addListener(eventName: RewardInterstitialAdPluginEvents.Showed, listenerFunc: () => void) => Promise<PluginListenerHandle>Listens for rewarded interstitial ad shown events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------- |
| eventName | RewardInterstitialAdPluginEvents.Showed |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
addListener(RewardInterstitialAdPluginEvents.AdImpression, ...)
addListener(eventName: RewardInterstitialAdPluginEvents.AdImpression, listenerFunc: (data: AdMobRevenueData) => void) => Promise<PluginListenerHandle>Listens for rewarded interstitial impression-level ad revenue events.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------------- |
| eventName | RewardInterstitialAdPluginEvents.AdImpression |
| listenerFunc | (data: AdMobRevenueData) => void |
Returns: Promise<PluginListenerHandle>
Interfaces
AdMobInitializationOptions
| Prop | Type | Description | Default | Since |
| ---------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
| testingDevices | string[] | 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 |
AdLoadInfo
Information returned after an ad loads successfully.
| Prop | Type | Description |
| -------------- | ------------------- | -------------------------------- |
| adUnitId | string | The ad unit ID of the loaded ad. |
AppOpenAdOptions
Options for loading an App Open ad.
| Prop | Type | Description |
| ---------- | ------------------- | -------------------------------- |
| adId | string | The App Open ad unit ID to load. |
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 | () => Promise<void> |
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
