Admob.com allows developers to make money by displaying advertisements. Cordova supports the following ad types
- Banner Ads
- Interstitial (aka fullscreen ads)
Syntax
var admobid = {};
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
admobid = {
banner: 'ca-app-pub-5220248899755640/7077506610',
interstitial: 'ca-app-pub-5220248899755640/8554239818'
};
var defaultOptions = {
adSize: 'SMART_BANNER',
position: AdMob.AD_POSITION.BOTTOM_CENTER,
bgColor: 'black',
isTesting: true //enable true when you're testing
};
AdMob.setOptions(defaultOptions);
}
function displayBannerAd() {
AdMob.createBanner({
adId: admobid.banner
});
}
function displayFullScreenAd() {
AdMob.prepareInterstitial({
adId: admobid.interstitial
});
AdMob.showInterstitial();
}
AdMob.createBanner()
allows you to create banner advertisements, AdMob.prepareInterstitial(), AdMob.showInterstitial()
allows displaying fullscreen advertisements