I use Cordova 3.2.0 -0.3.0 and NetBeans 7.4 to develop a Cordoba application. Despite the fact that it works well in the Mobile Chrome browser, it does not work properly neither in my phone (Android 4.1.2) nor in the emulator (Android 4.3, API level 18).
The problem is that the event devicereadynever fires.
This is the code:
app.onReady = function(callback) {
$(document).ready(function() {
window.isphone = false;
if (document.URL.indexOf("http://") === -1
&& document.URL.indexOf("https://") === -1) {
window.isphone = true;
}
if (window.isphone) {
alert("isPhone");
document.addEventListener("deviceready", callback, false);
} else {
callback();
}
});
};
app.onReady(function(){ alert("test"); });
"test" is never displayed.
source
share