Created
February 6, 2015 05:20
-
-
Save prantikv/1ee296b99002d7860c65 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<script src="cordova.js"></script> | |
<style type="text/css"> | |
</style> | |
</head> | |
<body onload="domLoaded()"> | |
<div id="main">This is the body of the app</div> | |
<div>footer</div> | |
<script type="text/javascript"> | |
function adSetter(){ | |
alert("adsetter"); | |
if (admob) { | |
var adPublisherIds = { | |
ios : { | |
banner : "ca-app-pub-8440343014846849/3119840614", | |
interstitial : "ca-app-pub-8440343014846849/4596573817" | |
}, | |
android : { | |
banner: 'ca-app-pub-8440343014846849/3119840614', | |
interstitial : "ca-app-pub-8440343014846849/3119840614" | |
} | |
}; | |
var admobid = (/(android)/i.test(navigator.userAgent)) ? adPublisherIds.android : adPublisherIds.ios; | |
admob.setOptions({ | |
publisherId: admobid.banner, | |
interstitialAdId: admobid.interstitial | |
}); | |
admob.createBannerView(); | |
} else { | |
//if no admob present | |
} | |
} | |
function onDeviceReady(){ | |
alert("device ready"); | |
adSetter(); | |
} | |
function backCall(e){ | |
// pormt when back button is pressed on home screen | |
e.preventDefault(); | |
var action=confirm("Do you want to Exit"); | |
if(action){ | |
admob.requestInterstitialAd(); | |
// window.MediaScannerPlugin.scanFile(function(msg){},function(err){} ); | |
navigator.app.exitApp(); | |
} | |
} | |
function domLoaded(){ | |
document.addEventListener("deviceready", onDeviceReady, false); | |
document.addEventListener("backbutton", backCall, false); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment