I am developing one Cordova app with floatinghotpot AdMobpro plugin. The app has these codes:
index.html
<a href=“mainpage.html" id="btn_prepare" class="pure-button pure-button-primary">GO TO APP</a>
in the admobshow.js, I have these snippets:
$('#btn_prepare').click(function(){
AdMob.prepareInterstitial({
adId:admobid.interstitial,
});
AdMob.showInterstitial();
window.open($(this).attr('href'));
});
(The code is taken from here: https://github.com/floatinghotpot/cordova-admob-pro/blob/master/test/index.html
I want this to happen: 1.) User clicks Go To APP and the plugin shows Interstitial. 2.) When the User dismisses the interstitial, the mainpage.html should open.
But, what is now happening is: 1.) the mainpage.html opens first and then the interstitial is shown in a few seconds.
I want the mainpage.html to be shown only after the interstitial is shown. (Or when the interstitial is acted upon.) I don't want the mainpage.html to be shown automatically.
Can someone help me how to tweak the above code?
You need the code that prepares the interstitial
AdMob.prepareInterstitialto be called some time before the user clicks that button. The plugin needs some time preparing it, so it can't immediately show it when you callAdMob.showInterstitial().Just prepare the interstitial when the user enters the page for example.