Tutorial/How-To for Integrating Admob Mobile Ads

As Promised

Here is my step-by-step process for getting Admob working:

  1. Register for an Admob account, obviously
  2. Do File–>Output to the Web on your GDevelop project. Select Export to a Website; DO NOT MINIFY AND OPTIMIZE!
  3. Open the Intel XDK and start a New Project.
  4. Import Your HTML Codebase by selecting your GDevelop output directory. Click Continue and enter a project name.
  5. For the importer settings: keep the source directory blank, select No for cordova hybrid app, and select Yes for Game Project and enter GDevelop for the Game Engine text entry
  6. Once the project has been imported/created, go to the Project Tab, under Project Info click on the Cordova icon next to Upgrade . This will upgrade your project to the HTML+Cordova format
  7. Once your project is upgraded set all your app settings for build options, app icons, plugins you require, etc.
  8. Now it gets interesting. I never could get the “Phonegap Admob plugin” to work. This is the plugin listed under “Featured & Custom Cordova plugins”. What did work for me was the “Floatinghotpot” Admob plugin for Cordova
  9. To add the plugin into your XDK project: CORDOVA 3.X HYBRID MOBILE APP SETTINGS → PLUGINS AND PERMISSIONS → Third-Party Plugins → Add a Third-Party Plugin → Get Plugin from the Web, input:
    Name: AdMobPluginPro
    Plugin ID: com.google.cordova.admob
    [x] Plugin is located in the Apache Cordova Plugins Registry
  10. After adding in the plugin go to Develop Tab in XDK, open your index.html file and add imports for the intel XDK and cordova js scripts in head section:

<script src="intelxdk.js"></script> <script src="cordova.js"></script>make sure the intelxdk.js is before the cordova.js

  1. Finally, add in the Admob plugin script settings, something like this:

[code][/code]

  1. Please note that you have to fully build your XDK project to test the Admob functionality. Admob WILL NOT work under the XDK emulator

Working example here

Floatinghotspot Admob documentation

I hope this is useful to others.

This is great. Thanks! :sunglasses: