@capacitor-community/admob

中文文档
8.4.0发布于 2026/11/16MITTypeScriptESM + CJS构建来源已验证近 30 天下载 37.3万

A native plugin for AdMob

原始使用文档
文档目录76 节
  1. AdMob
  2. Maintainers
  3. Contributors ✨
  4. Demo
  5. Screenshots
  6. Overview
  7. Installation
  8. Google Mobile Ads SDK versions
  9. Android configuration
  10. iOS configuration
  11. Troubleshooting
  12. First test banner
  13. Choose by advertising goal
  14. Documentation
  15. Index
  16. API
  17. initialize(...)
  18. trackingAuthorizationStatus()
  19. requestTrackingAuthorization()
  20. setApplicationMuted(...)
  21. setApplicationVolume(...)
  22. loadAppOpen(...)
  23. showAppOpen(...)
  24. isAppOpenLoaded(...)
  25. addListener(AppOpenAdPluginEvents.Loaded, ...)
  26. addListener(AppOpenAdPluginEvents.FailedToLoad, ...)
  27. addListener(AppOpenAdPluginEvents.Opened, ...)
  28. addListener(AppOpenAdPluginEvents.Closed, ...)
  29. addListener(AppOpenAdPluginEvents.FailedToShow, ...)
  30. addListener(AppOpenAdPluginEvents.AdImpression, ...)
  31. showBanner(...)
  32. hideBanner()
  33. resumeBanner()
  34. removeBanner()
  35. prepareBanner(...)
  36. getAdaptiveBannerSize(...)
  37. getBannerSize()
  38. addListener(BannerAdPluginEvents.SizeChanged, ...)
  39. addListener(BannerAdPluginEvents.Loaded, ...)
  40. addListener(BannerAdPluginEvents.FailedToLoad, ...)
  41. addListener(BannerAdPluginEvents.Opened, ...)
  42. addListener(BannerAdPluginEvents.Closed, ...)
  43. addListener(BannerAdPluginEvents.AdImpression, ...)
  44. addListener(BannerAdPluginEvents.AdPaid, ...)
  45. requestConsentInfo(...)
  46. showPrivacyOptionsForm()
  47. showConsentForm()
  48. resetConsentInfo()
  49. prepareInterstitial(...)
  50. showInterstitial(...)
  51. addListener(InterstitialAdPluginEvents.FailedToLoad, ...)
  52. addListener(InterstitialAdPluginEvents.Loaded, ...)
  53. addListener(InterstitialAdPluginEvents.Dismissed, ...)
  54. addListener(InterstitialAdPluginEvents.FailedToShow, ...)
  55. addListener(InterstitialAdPluginEvents.Showed, ...)
  56. addListener(InterstitialAdPluginEvents.AdImpression, ...)
  57. prepareRewardVideoAd(...)
  58. showRewardVideoAd(...)
  59. addListener(RewardAdPluginEvents.adClicked, ...)
  60. addListener(RewardAdPluginEvents.FailedToLoad, ...)
  61. addListener(RewardAdPluginEvents.Loaded, ...)
  62. addListener(RewardAdPluginEvents.Rewarded, ...)
  63. addListener(RewardAdPluginEvents.Dismissed, ...)
  64. addListener(RewardAdPluginEvents.FailedToShow, ...)
  65. addListener(RewardAdPluginEvents.Showed, ...)
  66. addListener(RewardAdPluginEvents.AdImpression, ...)
  67. prepareRewardInterstitialAd(...)
  68. showRewardInterstitialAd(...)
  69. addListener(RewardInterstitialAdPluginEvents.FailedToLoad, …
  70. addListener(RewardInterstitialAdPluginEvents.Loaded, ...)
  71. addListener(RewardInterstitialAdPluginEvents.Rewarded, ...)
  72. addListener(RewardInterstitialAdPluginEvents.Dismissed, ...)
  73. addListener(RewardInterstitialAdPluginEvents.FailedToShow, …
  74. addListener(RewardInterstitialAdPluginEvents.Showed, ...)
  75. addListener(RewardInterstitialAdPluginEvents.AdImpression, …
  76. Interfaces


AdMob

@capacitor-community/admob

Capacitor community plugin for native AdMob.

Read the full documentation


Maintainers

MaintainerGitHubSocialWebsite
Masahiko Sakakibarardlabo@rdlabordlabo.dev
Saninn Salas DiazSaninn Salas Diaz@SaninnSalas—

Maintenance Status: Actively Maintained

Contributors ✨

Made with contributors-img.

Demo

Demo code is here.

Screenshots

BannerInterstitialRewardApp 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 sync

If 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:

VariableArtifactDefault
playServicesAdsVersioncom.google.android.gms:play-services-ads25.4.+
userMessagingPlatformVersioncom.google.android.ump:user-messaging-platform4.0.0
androidxCoreKTXVersionandroidx.core:core-ktx1.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

GoalAd formatGuide
Keep an ad visible alongside app contentBannerBanner Ads
Show a full-screen ad at a natural break without granting a rewardInterstitialInterstitial Ads
Offer a dedicated rewarded experienceRewardedRewarded Ads
Offer a reward at a natural transitionRewarded interstitialRewarded Ads
Monetize an app-open experienceApp OpenApp 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.initialize and 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 — feed placement, styling, 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 — upgrade steps and behavior changes in v8.2.0 and earlier versions.

Index

API

initialize(...)

initialize(options?: AdMobInitializationOptions | undefined) => Promise<void>

Initializes the Google Mobile Ads SDK.

ParamTypeDescription
optionsAdMobInitializationOptionsOptional 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.

ParamType
optionsApplicationMutedOptions

Since: 4.1.1


setApplicationVolume(...)

setApplicationVolume(options: ApplicationVolumeOptions) => Promise<void>

Reports the application audio volume to the Google Mobile Ads SDK.

ParamType
optionsApplicationVolumeOptions

Since: 4.1.1


loadAppOpen(...)

loadAppOpen(options: AppOpenAdOptions) => Promise<AdLoadInfo>

Loads an App Open ad and returns the loaded ad unit ID.

ParamType
optionsAppOpenAdOptions

Returns: Promise<AdLoadInfo>


showAppOpen(...)

showAppOpen(options?: AdShowOptions | undefined) => Promise<void>

Shows a loaded App Open ad.

ParamTypeDescription
optionsAdShowOptionsOptional. 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.

ParamTypeDescription
optionsAdShowOptionsOptional. 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.

ParamType
eventNameAppOpenAdPluginEvents.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.

ParamType
eventNameAppOpenAdPluginEvents.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.

ParamType
eventNameAppOpenAdPluginEvents.Opened
listenerFunc() => void

Returns: Promise<PluginListenerHandle>


addListener(AppOpenAdPluginEvents.Closed, ...)

addListener(eventName: AppOpenAdPluginEvents.Closed, listenerFunc: () => void) => Promise<PluginListenerHandle>

Listens for App Open ad closed events.

ParamType
eventNameAppOpenAdPluginEvents.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.

ParamType
eventNameAppOpenAdPluginEvents.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.

ParamType
eventNameAppOpenAdPluginEvents.AdImpression
listenerFunc(data: AdMobRevenueData) => void

Returns: Promise<PluginListenerHandle>


showBanner(...)

showBanner(options: BannerAdOptions) => Promise<void>

Displays a banner ad.

ParamTypeDescription
optionsBannerAdOptionsAdOptions

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


prepareBanner(...)

prepareBanner(options: BannerAdOptions) => Promise<void>

Preloads the next banner without changing the current display. Resolves when loaded. Call showBanner() with matching options to display it. Preparing again replaces the previous preparation; removeBanner() cancels it.

ParamType
optionsBannerAdOptions

getAdaptiveBannerSize(...)

getAdaptiveBannerSize(options?: { width?: number | undefined; } | undefined) => Promise<AdMobBannerSize>

Calculates the anchored adaptive banner size without creating or loading an ad. Uses the current safe-area-aware available width unless a width is provided. Dimensions are dp on Android and points on iOS. Recalculate after rotation or available-width changes. An explicit width does not resize showBanner().

ParamType
options{ width?: number; }

Returns: Promise<AdMobBannerSize>


getBannerSize()

getBannerSize() => Promise<AdMobBannerSize>

Returns the currently displayed banner size in dp (Android) or points (iOS). Returns zero dimensions before loading or while hidden, removed, or failed. Does not create, load, or show an ad.

Returns: Promise<AdMobBannerSize>


addListener(BannerAdPluginEvents.SizeChanged, ...)

addListener(eventName: BannerAdPluginEvents.SizeChanged, listenerFunc: (info: AdMobBannerSize) => void) => Promise<PluginListenerHandle>

Listens for changes to the displayed banner dimensions.

ParamTypeDescription
eventNameBannerAdPluginEvents.SizeChangedbannerAdSizeChanged
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.

ParamTypeDescription
eventNameBannerAdPluginEvents.LoadedbannerAdLoaded
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.

ParamTypeDescription
eventNameBannerAdPluginEvents.FailedToLoadbannerAdFailedToLoad
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.

ParamTypeDescription
eventNameBannerAdPluginEvents.OpenedbannerAdOpened
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.

ParamTypeDescription
eventNameBannerAdPluginEvents.ClosedbannerAdClosed
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.

ParamTypeDescription
eventNameBannerAdPluginEvents.AdImpressionAdImpression
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.

ParamType
eventNameBannerAdPluginEvents.AdPaid
listenerFunc(data: AdMobRevenueData) => void

Returns: Promise<PluginListenerHandle>


requestConsentInfo(...)

requestConsentInfo(options?: AdmobConsentRequestOptions | undefined) => Promise<AdmobConsentInfo>

Request user consent information

ParamTypeDescription
optionsAdmobConsentRequestOptionsConsentRequestOptions

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.

ParamTypeDescription
optionsAdOptionsAdOptions

Returns: Promise<AdLoadInfo>

Since: 1.1.2


showInterstitial(...)

showInterstitial(options?: AdShowOptions | undefined) => Promise<void>

Shows a loaded interstitial ad.

ParamTypeDescription
optionsAdShowOptionsOptional. 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.

ParamType
eventNameInterstitialAdPluginEvents.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.

ParamType
eventNameInterstitialAdPluginEvents.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.

ParamType
eventNameInterstitialAdPluginEvents.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.

ParamType
eventNameInterstitialAdPluginEvents.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.

ParamType
eventNameInterstitialAdPluginEvents.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.

ParamType
eventNameInterstitialAdPluginEvents.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.

ParamTypeDescription
optionsRewardAdOptionsRewardAdOptions

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.

ParamTypeDescription
optionsAdShowOptionsOptional. 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.

ParamType
eventNameRewardAdPluginEvents.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.

ParamType
eventNameRewardAdPluginEvents.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.

ParamType
eventNameRewardAdPluginEvents.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.

ParamType
eventNameRewardAdPluginEvents.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.

ParamType
eventNameRewardAdPluginEvents.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.

ParamType
eventNameRewardAdPluginEvents.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.

ParamType
eventNameRewardAdPluginEvents.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.

ParamType
eventNameRewardAdPluginEvents.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.

ParamTypeDescription
optionsRewardInterstitialAdOptionsRewardInterstitialAdOptions

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.

ParamTypeDescription
optionsAdShowOptionsOptional. 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.

ParamType
eventNameRewardInterstitialAdPluginEvents.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.

ParamType
eventNameRewardInterstitialAdPluginEvents.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.

ParamType
eventNameRewardInterstitialAdPluginEvents.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.

ParamType
eventNameRewardInterstitialAdPluginEvents.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.

ParamType
eventNameRewardInterstitialAdPluginEvents.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.

ParamType
eventNameRewardInterstitialAdPluginEvents.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.

ParamType
eventNameRewardInterstitialAdPluginEvents.AdImpression
listenerFunc(data: AdMobRevenueData) => void

Returns: Promise<PluginListenerHandle>


Interfaces

AdMobInitializationOptions

PropTypeDescriptionDefaultSince
testingDevicesstring[]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
initializeForTestingbooleanWhether to register {@link AdMobInitializationOptions.testingDevices} as test devices.false1.2.0
tagForChildDirectedTreatmentbooleanFor purposes of the Children's Online Privacy Protection Act (COPPA), there is a setting called tagForChildDirectedTreatment.3.1.0
tagForUnderAgeOfConsentbooleanWhen 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
maxAdContentRatingMaxAdContentRatingThe 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.

PropTypeDescription
status'authorized' | 'denied' | 'notDetermined' | 'restricted'The authorization status reported by App Tracking Transparency.

ApplicationMutedOptions

PropTypeDescriptionSince
mutedbooleanTo 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

PropTypeDescriptionSince
volume0 | 1 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9If 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.

PropTypeDescription
adUnitIdstringThe ad unit ID of the loaded ad.

AppOpenAdOptions

Options for loading an App Open ad.

PropTypeDescription
adIdstringThe App Open ad unit ID to load.

AdShowOptions

Options for selecting a previously loaded ad to show or inspect.

| Prop | Type | Description | Since | | ---------- | ------------------- | -----------------------------------------------------------------

版本与发布记录

@capacitor-community/admob 共发布 99 个版本,首次发布于 2020/06/27;过去 12 个月发布了 39 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
8.4.0latest2026/11/16今天
8.3.2-beta.pr509.shab23015c90e5fbeta2026/11/16今天
8.3.2-beta.pr508.shab18b9d12fcf92026/11/16今天
8.3.2-beta.pr507.sha711dbedd3e682026/11/16今天
8.3.2-beta.pr505.shae80d59bcafe62026/11/16今天
8.3.22026/11/16今天

其他发布通道:next → 8.0.0-0,beta → 8.3.2-beta.pr509.shab23015c90e5f。

关于 @capacitor-community/admob 的常见问题

@capacitor-community/admob 是什么?

A native plugin for AdMob

如何安装 @capacitor-community/admob?

在项目目录运行 npm install @capacitor-community/admob,或使用 pnpm add / yarn add / bun add。

@capacitor-community/admob 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@capacitor-community/admob 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@capacitor-community/admob 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@capacitor-community/admob 可以商用吗?

@capacitor-community/admob 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@capacitor-community/admob 的下载量有多少?

根据 npm 官方下载统计,@capacitor-community/admob 在 2026/10/09 – 2026/11/07 这 30 天内被下载 373,053 次,日均约 12,435 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@capacitor-community/admob 还在维护吗?

最新版本 8.4.0 发布于 2026/11/16(今天);至今共发布 99 个版本,其中过去 12 个月发布了 39 个;首次发布于 2020/06/27。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。