- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello can someone help me?
Now i have a banner and a interstitial that shows up when i start the app, i want the interstitial to show up after a button click not after 2-3 seconds after app start?
is this possible?
this is the code iam using
<script src='cordova.js'></script>
<script type="text/javascript">
var onDeviceReady=function(){
navigator.splashscreen.hide();
initAdMob();
showAdMobInterstitial();
showAdMobBanner();
};
document.addEventListener("deviceready",onDeviceReady,false);
function initAdMob(){
if ( window.plugins && window.plugins.AdMob ) {
var admob_key_banner = "xxxxxx";
var admob_key_interstitial = "xxxxxx";
window.plugins.AdMob.setOptions( {
publisherId: admob_key_banner,
bannerAtTop: false, // set to true, to put banner at top
overlap: false, // set to true, to allow banner overlap webview
offsetTopBar: true, // set to true to avoid ios7 status bar overlap
interstitialAdId: admob_key_interstitial,
autoShow: true, // autoshow intertitial Ad
isTesting: false // receiving test ad
});
} else {
alert("AdMob plugin not ready");
}
}
function showAdMobBanner(){
window.plugins.AdMob.createBannerView();
}
function showAdMobInterstitial(){
window.plugins.AdMob.createInterstitialView();
}
</script>
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
var onDeviceReady=function(){
navigator.splashscreen.hide();
initAdMob();
showAdMobInterstitial();
showAdMobBanner();
};
You are calling this function inside device ready. what you should actually do is create a button handler, call this function over there.Then you should call the button handler inside device ready.
We have a blank template.Have a look the button responds only when all the ready functions are triggered.
Start a new project -> blank template -> General -> HTML5+Cordova .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Our admob sample actually activates the ads on button click.
The sample ships with the XDK. You can create it by Start a new project -> Samples and Demos -> Genenral -> HTML5+Cordova -> Hello Admob.
It uses the floatighoptspot third party plugin so you will have to build the app, but you can use it for code reference.
Github link: https://github.com/gomobile/sample-hello-admob
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page