I\'m having some problems getting ads to work. I can\'t rap my brain around why it isn\'t working. I have the following plugins installed:
com.google.playservices 19
Raymond is right, I have used the following code to install the plugin
> Ionic plugin add cordova-plugin-admobpro
Note: Please upgrade your cordova CLI to version 5
Open app.js and just paste the following code inside .run method and done!
var admobid = {};
// select the right Ad Id according to platform
if( /(android)/i.test(navigator.userAgent) ) {
admobid = { // for Android
banner: 'ca-app-pub-3940256099942544/6300978111',
interstitial: 'ca-app-pub-XXXXXXXXXXXXXXXX/NNNNNNNNNN'
};
} else if(/(ipod|iphone|ipad)/i.test(navigator.userAgent)) {
admobid = { // for iOS
banner: 'ca-app-pub-3940256099942544/6300978111',
interstitial: 'ca-app-pub-XXXXXXXXXXXXXXXX/NNNNNNNNNN'
};
} else {
admobid = { // for Windows Phone
banner: 'ca-app-pub-3940256099942544/6300978111',
interstitial: 'ca-app-pub-XXXXXXXXXXXXXXXX/NNNNNNNNNN'
};
}
if(window.AdMob) AdMob.createBanner( {
adId:admobid.banner,
isTesting: true,
position:AdMob.AD_POSITION.BOTTOM_CENTER,
autoShow:true} );
if(window.AdMob) AdMob.prepareInterstitial( {
adId:admobid.interstitial,
autoShow:true} );
Don't forget to set 'isTesting: false' while deploying your app to the store.