I am using the following code to add admob on my ionic app, but it is not showing. I added the code in $ionicPlatform.ready. And I have added the cordova plugin.
if(window.plugins && window.plugins.AdMob) {
var admob_key = "xxxxxxxxxxxxxxxxx";
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'); }
);
}
How can I fix this?