Deviceready event does not fire in Cordoba 3.2.0

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() {
        // are we running in native app or in browser?
        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.

+4
source share
2 answers

, cordova.js.
, (: P), script, , ( , ).

+9

, deviceready , DOM , $(document).ready().

deviceready $(document).ready(). . , .

+3

All Articles