The Ultimate AdMob Monetization Solution for Cordova/Capacitor/Framework7.
This plugin is a complete rewrite and re-architecture of the classic AdMob integration, built specifically for the Google Mobile Ads Next Generation SDK.
It moves away from legacy implementations to modern SurfaceControl, optimized layouts, and background threading, ensuring maximum performance, stability, and revenue.
Maintained by the original creator of EMI-INDO/emi-indo-cordova-plugin-admob. This is not just an update; it is a brand new engine designed for 2026 and beyond.
(NEW) β‘οΈ Next-Gen special capacitor: capacitor-admob-nextgen
Google has introduced a fundamental shift in how ads are rendered on Android.
This plugin aligns perfectly with those changes to solve the most critical issues developers face today:
-
ANR Error Elimination: The legacy SDK is notorious for causing ANR (Application Not Responding) errors in the Google Play Console. This Next-Gen architecture fully resolves these threading bottlenecks. (See Google's Next-Gen Announcement)
-
Lifecycle Stability: Solves the notorious issue where Full-Screen Ads (Interstitial, Rewarded, App Open) would crash or disappear when the app goes to the background and returns to the foreground.
-
Smart Runtime Engine (Android 15 Edge-to-Edge): Intelligently detects and handles Android 14 (API 35) vs Android 15 (API 36) edge-to-edge conditions at runtime.
- Automatically secures the "Close/X" buttons on full-screen ads.
- When using the banner parameter
isOverlapping: false, it intelligently calculates the system safe bottom insets to push the WebView content up perfectly. - Ensures neither the ad nor your app UI is hidden behind the system navigation bar.
- Requires zero manual configuration from the user. (See Release v1.3.9-beta.1)
-
Cordova & Capacitor Agnostic: Intelligently identifies whether the runtime environment is Cordova or Capacitor (including deep native Java logic adjustments) to provide seamless compatibility.
-
Clean Architecture: Written from scratch using the official Next Gen SDK Examples, ensuring long-term compliance with Google Policies.
This plugin is designed with one goal:
increasing your eCPM and fill rates.
It incorporates advanced formats and technologies that are proven to outperform standard implementations.
This is the real Next-Gen feature, this plugin implements the specific Preload API methods: startBannerPreload and showPreloadedBanner.
- Zero Latency: Instead of loading an ad when you need it, the plugin maintains a "pool" of ready-to-show ads in the background.
- Instant Show: When you call
showPreloadedBanner, the ad appears instantly (0ms delay) from the pool.
Standard banners are often ignored by users.
This plugin supports Collapsible Banners natively.
- Impact: Typically delivers 3-5% higher revenue than standard or large adaptive banners.
- Mechanism: Shows a larger ad initially (anchored top/bottom) that can be collapsed by the user, drastically increasing visibility and click-through rates (CTR).
Move beyond simple 320x50 banners.
The Native Overlay feature allows you to render high-performance Native Ads that look like system notifications.
- Impact: Can yield 5-10% higher revenue compared to standard banners due to higher advertiser demand for Native assets.
- Smart Templates:
banner_bottom: A sleek, notification-style ad docked at the bottom.banner_top: Docked at the top.modal_center: A popup-style native ad.
- Policy Safe: Includes an
isOverlappingparameter. - You can choose to overlay the ad (float) or push the webview content (safe layout), preventing accidental clicks.
This plugin prioritizes the safety of your AdMob account and the stability of your app.
-
Smart Throttling (
retryInterval): Solves the dreaded "high requests, low impressions" (Invalid Traffic / IVT) issue. -
This parameter acts as a strict anti-spam safeguard.
-
If an ad load is accidentally triggered repeatedly by an app logic error (e.g., game loop, tick, or scroll event) before the ad surfaces and is viewed by the user, the
retryIntervalautomatically blocks the redundant requests.Without this safeguard, you face two fatal problems:
- Banner Ad Flickering: Ads are constantly being destroyed and redrawn before becoming visible.
- Account Ban: Aggressively pulling ads (spamming requests without impressions) is a serious violation of AdMob's Invalid Traffic policy.
-
Background Thread Loading: All ad requests are dispatched on background threads, ensuring your app's UI never freezes.
Fastest test (APK Debug): β‘ With github action (Optional)
This plugin is regularly updated to support the latest standards.
| Component | Platform | Version | Release Notes |
|---|---|---|---|
| GMA Next-Gen SDK | Android | 1.2.1 | View Notes |
| UMP SDK | Android | 4.0.0 | View Notes |
| Mobile Ads SDK | iOS | 13.3.0 | View Notes |
| UMP SDK | iOS | 3.1.0 | View Notes |
- π Releases notes
Install the plugin directly using the Cordova CLI, You must provide your AdMob App ID.
cordova plugin add cordova-plugin-admob-nextgen --save --variable APP_ID_ANDROID="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy" --variable APP_ID_IOS="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"
Add this to your config.xml to restore the plugin automatically.
<plugin name="cordova-plugin-admob-nextgen">
<variable name="APP_ID_ANDROID" value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy" />
<variable name="APP_ID_IOS" value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy" />
</plugin>
Supporting Mediation: β‘ admob-mediation-suite (Optional)
Supporting Native ads: β‘ cordova-plugin-admob-nextgen-native (Optional)
β‘ Capacitor Integration: Automated Setup for AdMob Next Gen .
β‘ AdMob Next Gen - Starter Capacitor Templates π .
β‘ FULL Cordova - simple example π .
IMPORTANT: Configure Global Settings and handle Privacy Consent (UMP) BEFORE initializing the SDK.
// Optional: Mute ads globally
admobNextGen.setAppVolume(0.5);
admobNextGen.setAppMuted(true);
// 1. Request Consent Information
admobNextGen.requestConsentInfo({
debug: false, // Set true for testing
reset: false,
tagForUnderAgeOfConsent: false
}, function() {
console.log("Consent Info Ready.");
startSdk();
}, function(err) {
console.error("Consent Error", err);
startSdk();
});
// --- Consent Events ---
document.addEventListener('on.consent.status.change', (data) => {
console.log(data);
});
on.consent.info.update
on.consent.form.dismissed
on.consent.status.change (obj)
on.consent.error (obj)
// 3. Initialize the SDK
function startSdk() {
admobNextGen.initialize({
maxAdContentRating: 'G', // 'G' | 'PG' | 'T' | 'MA' | ""
tagForChildDirectedTreatment: false, // true | false | null
tagForUnderAgeOfConsent: false, // true | false | null
// isNativeValidatorDisabled: false // optional param for: cordova-plugin-admob-nextgen-native
}, function() {
console.log(">>> AdMob SDK Initialized & Ready <<<");
}, function(err) {
console.error("SDK Init Failed", err);
});
}
// 4. Privacy options
admobNextGen.showPrivacyOptionsForm(function() {
startSdk();
}, function(err) {
startSdk();
});
For iOS 14+, Apple requires you to prompt the user before tracking their IDFA. The plugin provides manual control over this prompt so you can display it at the right time in your app's lifecycle.
function checkAppTracking() {
admobNextGen.requestTrackingAuthorization(
function(status) {
console.log("ATT Status: " + status);
// Returns: 'AUTHORIZED', 'DENIED', 'NOT_DETERMINED', 'RESTRICTED'
// Regardless of the ATT choice, initialize the SDK
startSdk();
},
function(err) {
console.warn("ATT Request Failed", err);
startSdk();
}
);
}
// You can also silently check the status anytime:
// admobNextGen.getTrackingAuthorizationStatus(success, error);
You can check if the user has granted permission for Personalized Ads without parsing complex IAB strings manually.
admobNextGen.getTCData(function(data) {
// --- SMART ANALYSIS (Easy) ---
console.log("Personalized Allowed: " + data.isPersonalizedAllowed); // Boolean: true/false
console.log("Status: " + data.statusMessage);
// --- RAW DATA (Expert) ---
console.log("TC String: " + data.tcString);
console.log("GDPR Applies: " + data.gdprApplies); // 1=Yes, 0=No
console.log("Purpose Consents: " + data.purposeConsents);
});
Supports Adaptive, Standard, and Collapsible banners.
admobNextGen.createBanner({
adUnitId: 'ca-app-pub-xxx/xxx',
position: 'bottom', // 'top' or 'bottom'
size: 'ADAPTIVE', // 'BANNER', 'LARGE_BANNER', 'MEDIUM_RECTANGLE', 'ADAPTIVE', 'FULL_BANNER', 'LEADERBOARD'
isOverlapping: false, // true = Overlay, false = Push Webview
collapsible: true, // true = Enable Collapsible Format (High Revenue)
retryInterval: 5000, // Anti-spam delay (ms)
isAutoShow: true
});
new banner size min plugin version: 1.2+
- LARGE_LANDSCAPE_ANCHORED_ADAPTIVE
- LARGE_PORTRAIT_ANCHORED_ADAPTIVE
- CURRENT_ORIENTATION_INLINE_ADAPTIVE
- LARGE_ANCHORED_ADAPTIVE
- PORTRAIT_INLINE_ADAPTIVE
admobNextGen.showBanner();
admobNextGen.hideBanner();
admobNextGen.removeBanner();
document.addEventListener('on.banner.load', (data) => {
console.log("Banner Loaded: " + data.width + "x" + data.height);
console.log("Collapsible: " + data.isCollapsible);
});
document.addEventListener('on.banner.failed', (err) => console.error(err));
document.addEventListener('on.banner.revenue', (data) => {
console.log("Revenue: " + data.value + " " + data.currency);
});
document.addEventListener('on.banner.clicked', () => console.log("Clicked"));
document.addEventListener('on.banner.impression', () => console.log("Impression"));
// else
on.banner.opened
on.banner.closed
on.banner.failed.show
on.banner.refreshed
on.banner.refresh.failed
- Recommended: β‘ cordova-plugin-admob-nextgen-native (Android | IOS)
High-performance native templates.
// Android Only
admobNextGen.createNativeAd({
adUnitId: 'ca-app-pub-xxx/xxx',
view: 'banner_bottom', // Presets: 'banner_top', 'banner_bottom', 'modal_center'
isOverlapping: false, // true = Overlay, false = Push Content
retryInterval: 5000
});
// Android Only
admobNextGen.createNativeAd({
adUnitId: 'ca-app-pub-xxx/xxx',
view: 'custom',
x: 20, // X Position in dp
y: 100, // Y Position in dp
width: 300, // Width in dp
height: 300, // Height in dp
isOverlapping: true // Typically true for custom floating ads
});
// Android Only
admobNextGen.removeNativeAd();
document.addEventListener('on.native.loaded', () => console.log("Native Loaded"));
document.addEventListener('on.native.revenue', (data) => console.log("Revenue:", data.value));
// else
on.native.shown
on.native.failed
on.native.dismissed
on.native.show.failed (obj)
on.native.impression
on.native.clicked
Supports Auto-Resume logic.
admobNextGen.loadAppOpenAd({
adUnitId: 'ca-app-pub-xxx/xxx',
isAutoShow: true, // Automatically show when app resumes from background
retryInterval: 5000
});
admobNextGen.showAppOpenAd();
document.addEventListener('on.appopen.revenue', (data) => console.log(data));
document.addEventListener('on.appopen.dismissed', () => console.log("Closed"));
// else
on.appopen.loaded
on.appopen.failed.load (obj)
on.appopen.failed.show (obj)
on.appopen.revenue (obj)
on.appopen.shown
on.appopen.dismissed
on.appopen.failed.show (obj)
on.appopen.impression
on.appopen.clicked
admobNextGen.createInterstitial({
adUnitId: 'ca-app-pub-xxx/xxx',
isAutoShow: true, // Show immediately when loaded
retryInterval: 5000
});
// Manual Show
// admobNextGen.showInterstitial();
document.addEventListener('on.interstitial.revenue', (data) => console.log(data));
document.addEventListener('on.interstitial.dismissed', () => console.log("Closed"));
// else
on.interstitial.loaded
on.interstitial.failed.load (obj)
on.interstitial.failed.show (obj)
on.interstitial.revenue (obj)
on.interstitial.shown
on.interstitial.dismissed
on.interstitial.failed.show (obj)
on.interstitial.impression
on.interstitial.clicked
admobNextGen.createRewarded({
adUnitId: 'ca-app-pub-xxx/xxx',
retryInterval: 5000, // Anti-spam interval
isAutoShow: false // Default false (User must opt-in)
});
// Show manually when ready
admobNextGen.showRewarded();
document.addEventListener('on.rewarded.earned', (data) => {
console.log("User Earned: " + data.amount + " " + data.type);
});
document.addEventListener('on.rewarded.revenue', (data) => console.log(data));
// else
on.rewarded.loaded
on.rewarded.failed.load (obj)
on.rewarded.failed.show (obj)
on.rewarded.revenue (obj)
on.rewarded.shown
on.rewarded.canceled
on.rewarded.dismissed
on.rewarded.failed.show (obj)
on.rewarded.impression
on.rewarded.clicked
Auto-showing rewarded format (no opt-in).
admobNextGen.createRewardedInterstitial({
adUnitId: 'ca-app-pub-xxx/xxx',
isAutoShow: true,
retryInterval: 5000 // Anti-spam interval
});
document.addEventListener('on.rewardedInter.earned', (data) => console.log(data));
document.addEventListener('on.rewardedInter.revenue', (data) => console.log(data));
// else
on.rewardedInter.loaded
on.rewardedInter.failed.load (obj)
on.rewardedInter.failed.show (obj)
on.rewardedInter.revenue (obj)
on.rewardedInter.shown
on.rewardedInter.canceled
on.rewardedInter.dismissed
on.rewardedInter.failed.show (obj)
on.rewardedInter.impression
on.rewardedInter.clicked
The AdMob Next-Gen SDK introduces a powerful background Preloader Engine that caches ads in a buffer pool, enabling zero-latency ad rendering.
β οΈ IMPORTANT WARNING & BEST PRACTICES:
- Android Only: The Preloader engine is currently an exclusive feature of the Android Next-Gen SDK.
- Strict Method Separation: NEVER mix Classic methods with Preloader methods to avoid logic conflicts.
- If you use
createBanner, you MUST useshowBanner.- If you use
startBannerPreload, you MUST useshowPreloadedBanner.- Cross-Platform (iOS) Consideration: Events are unified. A
sourceflag (data.source === "preloader") is injected into the event data on Android. However, it is highly recommended to maintain a single unified logic flow. Relying strictly on thesource === "preloader"condition will cause issues on iOS, as iOS relies entirely on the Classic implementation.
| Ad Format | Start Preload | Show Polled Ad | Other Preload Methods |
|---|---|---|---|
| Banner | startBannerPreload(obj) |
showPreloadedBanner() |
stopBannerPreload(), hideBannerPreload() |
| App Open | startAppOpenPreload(obj) |
showPreloadedAppOpenAd() |
isAppOpenAdAvailable() |
| Interstitial | startInterstitialPreload(obj) |
showPreloadedInterstitial() |
stopInterstitialPreload(), isInterstitialAdAvailable() |
| Rewarded | startRewardedPreload(obj) |
showPreloadedRewarded() |
stopRewardedPreload(), isRewardedAdAvailable() |
| Rewarded Interstitial | startRewardedInterstitialPreload(obj) |
showPreloadedRewardedInterstitial() |
stopRewardedInterstitialPreload(), isRewardedInterstitialAdAvailable() |
1. Start the Preloader Run this once (e.g., after SDK initialization). The engine will automatically maintain the buffer in the background.
admobNextGen.startRewardedPreload({
adUnitId: 'ca-app-pub-xxx/xxx',
bufferSize: 2, // (Optional) Number of ads to cache. Default: 1 max 3
isAutoShow: false, // (Optional) Show immediately when the first ad is ready
retryInterval: 5000 // (Optional) Anti-spam protection in ms
});2. Show the Preloaded Ad Call this when the user interacts with your app. It will render instantly from the local buffer.
admobNextGen.showPreloadedRewarded();To streamline development, the Preloader triggers the exact same lifecycle events as the Classic mode (e.g., on.rewarded.loaded, on.rewarded.dismissed). You only need to write one event listener for both modes.
Preloader Exclusive Event:
The only event strictly unique to the Preloader is the exhausted event. This fires when the buffer pool is completely empty and the SDK stops trying to fetch new ads.
// Example: Unique Preloader Event
document.addEventListener('on.rewarded.exhausted', () => {
console.warn("Background ad buffer is empty!");
});Optional: Checking the Event Source
If you need to execute specific conditional logic for the preloader, you can check data.source. (Remember: This flag is Android-only).
document.addEventListener('on.rewarded.loaded', (e) => {
let data = e.data || e;
if (data && data.source === "preloader") {
console.log("Ad loaded via Android Preloader Engine");
} else {
console.log("Ad loaded via Classic Engine (or iOS)");
}
});No Ad-Sharing. No Hidden Fees.
Unlike many other free plugins, this project is clean:
- 0% Revenue Share: This plugin do not inject our own Ad Unit IDs into your traffic.
- 100% Control: Every impression and click goes directly to your AdMob account.
- Transparent Source: The code is open source. You can verify that no third-party SDKs or hidden backdoors exist.
This plugin is developed and maintained in my free time. If it saved you hours of work, consider supporting the development!
Your support helps me keep the dependencies updated and the cleaner script running smoothly.
Built with β€οΈ by Swaplab Engine (formerly EMI-INDO).