Here are the steps you need to follow:
ionic platform add android
ionic platform add ios
cordova plugin add com.rjfun.cordova.plugin.admob
- Copy and paste the code into the app.js's run module
The code snippet is as follows:
$ionicPlatform.ready(function() {
if(window.plugins && window.plugins.AdMob) {
var admob_key = device.platform == "Android" ? "ANDROID_PUBLISHER_KEY" : "IOS_PUBLISHER_KEY";
var admob = window.plugins.AdMob;
admob.createBannerView( {
'publisherId': admob_key,
'adSize': admob.AD_SIZE.BANNER,
'bannerAtTop': false
},
function() {
admob.requestAd({ 'isTesting': false },
function() {
admob.showAd(true);
},
function() { console.log('failed to request ad'); });
},
function() { console.log('failed to create banner view'); });
}
});
Best regards.