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.
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:
- 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.
- Android 15+ Compatibility: Includes a built-in workaround for the Android 15 Edge-to-Edge enforcement. It ensures the "Close/X" buttons on full-screen ads are never hidden behind the system navigation bar (API Level 35 fix).
- 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. We have implemented advanced formats and technologies that are proven to outperform standard implementations.
This is the real Next-Gen feature. We have implemented 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 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.
We prioritize the safety of your AdMob account and the stability of your app.
- Smart Throttling (
retryInterval): Prevents accidental spamming of ad requests using a global interval validation.
- If the loadAd or showAd function is called repeatedly accidentally by JavaScript (for example because it is tied to a scroll event or application loop), the system will continuously call loadAd or showAd.
- Banner Ad Flickering: Ads are constantly being destroyed and redrawn.
- Account Ban: Aggressively pulling ads (spamming impressions) is a serious violation of AdMob's Invalid Traffic (IVT) policy.
- Background Thread Loading: All ad requests are dispatched on background threads, ensuring your app's UI never freezes.
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" spec="latest">
<variable name="APP_ID_ANDROID" value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy" />
<variable name="APP_ID_IOS" value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy" />
</plugin>
β‘ Capacitor Integration: Automated Setup for AdMob Next Gen .
β‘ AdMob Next Gen - Starter 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,
tagForUnderAgeOfConsent: false
}, 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
});
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
High-performance native templates.
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
});
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
});
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
Use the background engine to pool ads for 0ms latency.
// 1. Start Engine
admobNextGen.startBannerPreload({
adUnitId: 'ca-app-pub-xxx/xxx',
size: 'ADAPTIVE', // 'BANNER', 'LARGE_BANNER', 'MEDIUM_RECTANGLE', 'ADAPTIVE', 'FULL_BANNER', 'LEADERBOARD'
position: 'bottom', // 'top' or 'bottom'
collapsible: false, // true = Enable Collapsible Format (High Revenue)
isOverlapping: false,
retryInterval: 5000 // Anti-spam delay (ms)
});
// 2. Show Instantly (from pool)
admobNextGen.showPreloadedBanner();
// 3. Stop Engine
admobNextGen.stopBannerPreload();
### Banner Events
document.addEventListener('on.banner.load', (data) => {
console.log("Banner Loaded: " + data.width + "x" + data.height);
console.log("Collapsible: " + data.isCollapsible);
});
document.addEventListener('on.preload.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.preload.available
on.preload.failed
on.preload.exhausted
on.banner.opened
on.banner.closed
on.banner.failed.show
on.banner.refreshed
on.banner.refresh.failed
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
No Ad-Sharing. No Hidden Fees.
Unlike many other free plugins, this project is clean:
- 0% Revenue Share: We 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).