Open lumierephoto opened 8 years ago
function onDeviceReady() { admob.cacheInterstitial(); } function onGameOver(){//call this fun to show when game over, at the same time to show your game over panel admob.isInterstitialReady(function(isReady){ if(isReady){ admob.showInterstitial(); } }); }
with this version plugin https://github.com/admob-google/admob-cordova
Thanks for the quick response.
I'll try it out and get back to you.
Wait.
Are you saying to use this plugin instead?
https://github.com/admob-google/admob-cordova
Not the Phonegap plugin?
https://github.com/admob-google/admob-phonegap
If so, why? I believe my project is Phonegap and not Cordova, that's why I ask.
the plugin is the same for cordova and phonegap. https://github.com/admob-google/admob-cordova is a upgraded version of https://github.com/admob-google/admob-phonegap. and just fix some bug and optimize api.
I've tested the index.html in the Example folder and got the app to shows ads.
However, I'm looking for a more real world solution where I can load an interstitial ad on Game Over in a HTML 5 game. I don't want to have to manually cache the ad and then trigger the interstitial with a button.
What is the best way to do this?
I've tried triggering the load interstitial and show interstitial in their own functions and then loading them in the body onLoad like so:
`function onLoad(){ admob.cacheInterstitial(); document.addEventListener('deviceready',onDeviceReady, false); }
function onDeviceReady() { showInterstitial(); }
body onload="onLoad();"`
However this didn't work.
I haven't done this successfully with Javascript as this isn't my best language. Any help appreciated!