How to show ads with AdMob and Intel XDK

Create an AdMob account and an ad unit

To get started, go on AdMob website and create an account. Once it's done, you can create a new ad unit.

Click on Monetize a new app:

Then add your application by entering its name and choosing its platform (if your game is for both iOS and Android, you must register two ad units).

You can then choose if you want to create the ad unit to display a banner or an interstitial screen. To begin, we're going to display a banner.

In the end, note the ad unit identifier:

Add the AdMob object to your game

Insert a new object on the scene and choose the AdMob object:

Make sure that the object is put somewhere on the scene and double click on it to display its properties. Enter the ad unit identifiers:

Your object is now ready to display the banner!

About interstitial screens

An interstitial screen is an ad that covers the whole screen and has a button to close it. It is usually presented at the end of a level.

If you want to display an interstitial screen, you have to fill the interstitial ID fields (either for iOS or Android or both) and use the action to show the interstitial screen. For example, you can add this action when you detect that the player just ended the level, or at the beginning of a scene displaying the game-ending score.

About test mode

By default, the AdMob object is in testing mode: it can be used to display fake AdMob ads and be sure that everything works. When exporting your game to publish it, be sure to uncheck Testing mode.

Export the game

To enable AdMob ads, you must export your game with Intel XDK 1). In GDevelop, export your project and choose Export to iOS or Android with Cordova (Intel XDK).

When the export is done, import your project in Intel XDK.

Don't know how it works? Go read the Intel XDK tutorial!
In a nutshell, you have to open Intel XDK, click on Start A New Project, then Import Your HTML5 CodeBase, choose the folder where your game was exported and click on Continue.

Activate the AdMob plugin

When your game project is opened in Intel XDK, you have to enable a third party plugin that will allow you to display the ads.

  • Click on Projects (in the top left), and choose your project in the list,
  • in Cordova Hybrid Mobile App Settings, open the Third-Party Plugins tab and choose Get Plugin From the Web:

  • Enter AdMob plugin as the name of the plugin (it does not really matter), then for the Plugin ID. Finally, check Plugin is located in the Apache Cordova Plugins Registry and click on Import when you're done.

You're ready to build the game packages!

You can now build your game using the Intel XDK as usual: basically, in the Build tab, choose Crosswalk for Android or iOS.

When you'll launch your game, the banner will be displayed:

If nothing is shown, please be sure that:
  • You have activated the plugin as described.
  • You have put the AdMob object somewhere on the scene.
  • You have entered the right Banner or Interstitial ID for the right platform.
  • Activate Testing Mode (that's done by default) the first time you try to integrate ads.
or any Cordova compatible platform for advanced users