i am trying to display admob inside my application but it's not getting displayed on screen.
I added its plugins :- cordova plugin add com.rjfun.cordova.plugin.admob cordova plugin add https://github.com/floatinghotpot/cordova-plugin-admob.git
here is my code which i have done in my app.js class under run function :-
$ionicPlatform
.ready(function() {
if (window.plugins && window.plugins.AdMob) {
alert('inside');
var admob_key = device.platform == "Android" ? "ca-app-pub-6869992474017983/4748283957" : "IOS_PUBLISHER_KEY";
var admob = window.plugins.AdMob;
admob
.createBannerView({
'adId': admob_key,
'position': admob.AD_POSITION.BOTTOM_CENTER,
'adSize': admob.AD_SIZE.BANNER,
'bannerAtTop': false
},
function() {
admob
.requestAd({
'isTesting': false
},
function() {
admob
.showAd(true);
},
function() {
alert("failed to request ad");
console
.log('failed to request ad');
});
},
function() {
alert("failed to create banner view");
console
.log('failed to create banner view');
});
} else {
alert("AdMob plugin not available/ready.");
}
links from which i refer above code :-
1) https://blog.nraboy.com/2014/06/using-admob-ionicframework/
2) https://github.com/floatinghotpot/cordova-admob-pro
Please provide me any suggestion on it.
Thanks