I'm trying to display interstitial Ad in my PhoneGap app but it's not working; it's not displaying the ad at all. I followed the instructions here.
Apart from trying to make it work, what I also need to do is to show the interstitial at a particular time (probably when the game is over) but I dont know how to refer to the Java code from JavaScript code to show the loaded interstitial ad.
Please help.
I recently got AdMob working within my Cordova 4 project after much fiddling. Forget the instructions you linked to in your question, which are not for cordova/phonegap builds.
Step 1: You will need to install the Cordova/Phonegap plugin for Admob. (This assumes you have already created the project files.) In my case, e.g. for Cordova command line interface, I used Terminal,
cd
to my project's root directory and then type:For your Phonegap setup, you will likely need to do one of the following:
Add this to your project's config.xml file.
OR (for Phonegap CLI), type this command into Terminal from your project's root directory,
Once you have the plugin, you can use javascript to control Admob behavior.
Step 2: Add appropriate javascript for Admob plugin to your project, linked in your index.html file. I ran into some trouble here, so just to prove to myself that the plugin really works, I removed (backed up) everything from my project's WWW folder and added the exact files from the WWW folder from this project and later this one on Github. Both work. It was then a matter of making smarter-people-than-myself's javascript work in my app.
A few tips
<script type="text/javascript" src="cordova.js"></script>
in your head of your index file.