UNPKG

cordova-plugin-admobpro

Version:

Ultimate Cordova Plugin for Google AdMob and DFP to monetize hybrid apps. Show mobile Ad with single line of JavaScript. Compatible with Cordova CLI, PhoneGap Build, Intel XDK/Crosswalk, Google ChromeApp, Ionic, Meteor, etc.

43 lines (37 loc) 1.2 kB
var admobid = {}; if( /(android)/i.test(navigator.userAgent) ) { admobid = { // for Android banner: 'ca-app-pub-6869992474017983/9375997553', interstitial: 'ca-app-pub-6869992474017983/1657046752' }; } else if(/(ipod|iphone|ipad)/i.test(navigator.userAgent)) { admobid = { // for iOS banner: 'ca-app-pub-6869992474017983/4806197152', interstitial: 'ca-app-pub-6869992474017983/7563979554' }; } else { admobid = { // for Windows Phone banner: 'ca-app-pub-6869992474017983/8878394753', interstitial: 'ca-app-pub-6869992474017983/1355127956' }; } if(( /(ipad|iphone|ipod|android|windows phone)/i.test(navigator.userAgent) )) { document.addEventListener('deviceready', initApp, false); } else { initApp(); } function initApp() { if (! AdMob ) { alert( 'admob plugin not ready' ); return; } AdMob.createBanner( { adId: admobid.banner, isTesting: true, overlap: false, offsetTopBar: false, position: AdMob.AD_POSITION.BOTTOM_CENTER, bgColor: 'black' } ); AdMob.prepareInterstitial({ adId: admobid.interstitial, autoShow: true }); }