I have a phonegap project built for android and uses cordova. I planted a web-based app in this phonegap project. This app has one html page, index.html. In this index file, onDeviceReady() function is not called. However, this page is working perfect, only that it is called from mainactivity and for some reason it does not step into this function. It's probably overriden by a cordova function. Question: How do I make this function work in index.html file? Which function overrides/replaces this one?
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// device APIs are available
//
function onDeviceReady() {
// Register the event listener
document.addEventListener("backbutton", onBackKeyDown, false);
}
// Handle the back button
//
function onBackKeyDown(e) {
e.preventDefault();
navigator.notification.confirm("×”×?×? ×‘×¨×¦×•× ×? ×?צ×?ת?", onConfirm, "יצי×?×”", "יצי×?×”,ביטו×?");
}
function onConfirm(button) {
if(button==2){//If User selected No, then we just do nothing
return;
}else{
navigator.app.exitApp();// Otherwise we quit the app.
}
}
What happens here is that onLoad is called, and onDeviceReady is never called.