ngCordova and $cordovaAdMob

andrea mucci
Pixel Heart
Published in
1 min readSep 8, 2014

ngCordova is a very useful and well done project, but unfortunately some extensions are not well documented.
Personally I found a bit of difficulty installing the module AdMob
First I used this plugin:
https://github.com/floatinghotpot/cordova-plugin-admob
and not the version “pro” that appears in the documentation
Thereafter, you must add the following code just after:


ionicPlatform.ready $ (function ()
….

the code in question is:

var ad_units =
ios: {
banner: ‘app-ca-pub-1499928428419652/751861492'
}
};
var options = {
publisherID: ad_units.ios.banner,
bannerAtTop: false, // Set to true, to put banner at top
overlap: false, // True to allow banner overlap webview
offsetTopBar: true, // True to avoid ios7 status bar overlap
isTesting: true, // receiving test to
Autoshow: true // auto show interstitial When loaded to
};
//prepare the banner view
$cordovaAdMob.createBannerView(options,
function () {
console.log (“success”);
},
function (){
console.log (“error”);
}
);
//show the banner
$cordovaAdMob.showAd(true,
function () {
console.log (“success”);
},
function () {
console.log (“error”);
}
);

options can be changed according to your needs

--

--

andrea mucci
Pixel Heart

Product of Italian Design from the summer of 75. In 2020, thanks to the pandemic lockdown i have released a python microservice framework calles MinOS.