Admob integration for mobiles

I plan to monetize my game via Admob and of course I’ll have to write some JS code to do that, because GD doesn’t support it. Oh well.

Of course I’d love if Admob would be integrated into GD so I can easily use it, hence the request (in any case when I’ll successfully integrate Admob, I’ll put up tutorial just like I did with uploading to Kongregate).

I’d be interested if you come across with a tutorial/example about using AdMod :slight_smile:

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.

Export as HTML5 to a directory and just copy/paste the XDK project files after, should work (these files contains nothing special).

Thanks! Are you developing this feature? It’s very important because unless you have some big license like Minecraft actually selling game on Google Play isn’t a good idea, ad-supported games fare better, just look at Flappy Bird (if I realize gameplay I have in mind, my game will be just as addicting as Flappy Bird was).

Working on having a PPA for GDevelop on Ubuntu for now, not on AdMob (unless you successed in showing ads).