Here is my step-by-step process for getting Admob working:
- Register for an Admob account, obviously
- Do File–>Output to the Web on your GDevelop project. Select Export to a Website; DO NOT MINIFY AND OPTIMIZE!
- Open the Intel XDK and start a New Project.
- Import Your HTML Codebase by selecting your GDevelop output directory. Click Continue and enter a project name.
- 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
- 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
- Once your project is upgraded set all your app settings for build options, app icons, plugins you require, etc.
- 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
- 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:
Plugin ID: com.google.cordova.admob
[x] Plugin is located in the Apache Cordova Plugins Registry
- 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="cordova.js"></script>make sure the intelxdk.js is before the cordova.js
- Finally, add in the Admob plugin script settings, something like this:
- Please note that you have to fully build your XDK project to test the Admob functionality. Admob WILL NOT work under the XDK emulator
I hope this is useful to others.