Actually… I did: software.intel.com/en-us/html5/ … pplication But you need to figure out which Cordova plugin to use. I’m fighting with com.admob.google right now and don’t have good results. Here’s the code I’m using to initialize it:
[code] function initAds() {
if (admob) {
var adPublisherIds = {
ios : {
banner : “ca-app-pub-9947883591260364/6396354534”,
interstitial : “ca-app-pub-9947883591260364/3442888132”
},
android : {
banner : “ca-app-pub-9947883591260364/6396354534”,
interstitial : “ca-app-pub-9947883591260364/3442888132”
}
};
var admobid = (/(android)/i.test(navigator.userAgent)) ? adPublisherIds.android : adPublisherIds.ios;
admob.setOptions({
publisherId: admobid.banner,
interstitialAdId: admobid.interstitial,
adSize: tappx.AD_SIZE.SMART_BANNER,
bannerAtTop: false,
overlap: false,
offsetStatusBar: false,
isTesting: false,
adExtras : {},
autoShowBanner: false,
autoShowInterstitial: false
});
// registerAdEvents();
} else {
alert('AdMobAds plugin not ready');
}
}
function onAdLoaded(e) {
if (e.adType === admob.AD_TYPE.INTERSTITIAL) {
admob.showInterstitialAd();
showNextInterstitial = setTimeout(function() {
admob.requestInterstitialAd();
}, 2 * 60 * 1000); // 2 minutes
}
}
function admobready() {
document.removeEventListener(‘deviceready’, onDeviceReady, false);
initAds();
// display a banner at startup
admob.createBannerView();
// request an interstitial
admob.requestInterstitialAd();
}
document.addEventListener("deviceready", admobready, false);
function showAdMobBanner(){
admob.showAd();
}
function showAdMobInterstitial(){
admob.requestInterstitialAd();
admob.showInterstitialAd();
}[/code]
then in game I try to use showAdMobInterstitial() to run ad. Either of two happen:
- I get black screen
- Nothing happens
Most likely I’m doing something wrong.
Here’s that plugin: plugins.cordova.io/#/package/com.admob.google
By the way, is there any way to make it so GD won’t re-generate XDK project each time I export game? It’s annoying to have re-enter every info.