admob phonegap(cordova) plugin,support ios and android
build base on phonegap 3.4 or cordova 3.5
home:https://github.com/gooogleadmob/phonegap-admob-plugin/
phonegap:http://docs.phonegap.com/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface
###how to install google admob phonegap plugin?
use the cordova command
download the plugin ,then install with local location
cordova plugin add c:\phonegap-admob-plugin (plugin saved position)
how to use admob phonegap plugin?
###1.create and show admob banner ad in html5 app
function showBanner() {
var successCreateBannerView = function () {
admobAd.showBanner(admobAd.AD_POSITION.BOTTOM_CENTER);//show banner at the bottom center
};
var errorCreateBannerView = function (message) {
console.log("create ad fail " + message);
};
admobAd.initBanner("your admob id here", admobAd.AD_SIZE.BANNER.width, admobAd.AD_SIZE.BANNER.height, successCreateBannerView, errorCreateBannerView);//create admob banner
}
showBanner();
###2.show admob Interstitial in cordova app :
function onInterstitialReceive(message) {
admobAd.showInterstitial();//show Interstitial after receive or after game over
}
function successCreateInterstitial() {
admobAd.cacheInterstitial();// load admob Interstitial
}
document.addEventListener('onAdmobInterstitialReceive', this.onInterstitialReceive, false);//handler admob event
admobAd.initInterstitial("your admob id here", successCreateInterstitial);//create Interstitial ad
###3.handle admob ad event
you can handler all native event of admob ,as onInterstitialReceive
all event type is in AdEvent
document.addEventListener('onAdmobBannerDismiss', this.onAdmobEvent, false);
document.addEventListener('onAdmobBannerFailedReceive', this.onAdmobEvent, false);
document.addEventListener('onAdmobBannerLeaveApplication', this.onAdmobEvent, false);
document.addEventListener('onAdmobBannerPresent', this.onAdmobEvent, false);
document.addEventListener('onAdmobBannerReceive', this.onAdmobEvent, false);
document.addEventListener('onAdmobInterstitialDismiss', this.onAdmobEvent, false);
document.addEventListener('onAdmobInterstitialFailedReceive', this.onAdmobEvent, false);
document.addEventListener('onAdmobInterstitialLeaveApplication', this.onAdmobEvent, false);
document.addEventListener('onAdmobInterstitialPresent', this.onAdmobEvent, false);
document.addEventListener('onAdmobInterstitialReceive', this.onAdmobEvent, false);
###more function
1.show admob banner with Absolute position
showBannerAbsolute(x,y, successCallback, failureCallback)
2.hide admob banner
hideBanner()
3.test if Interstitial has loaded success
function isInterstitialReady( successCallback, failureCallback)
4.for more usage ,ref to index.js
contact:gooogleadmob@gmail.com