deviceready not firing

15 views
Skip to first unread message

Judy Fong

unread,
Jul 5, 2013, 5:22:22 PM7/5/13
to phon...@googlegroups.com
Hi everyone,

I can't "deviceready" to fire on my app.

<!DOCTYPE html>
<html>
  <head>
    <title>Cordova Device Ready Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova-2.6.0.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Call onDeviceReady when Cordova is loaded.
    //
    // At this point, the document has loaded but cordova-1.7.0.js has not.
    // When Cordova is loaded and talking with the native device,
    // it will call the event `deviceready`.
    //
        document.addEventListener("deviceready", onDeviceReady, false);
        document.addEventListener("online", onDeviceReady, false);

    // Cordova is loaded and it is now safe to make calls Cordova methods
    //
    function onDeviceReady() {
        // Now safe to use the Cordova API
        alert("I am an alert box!");
        var element = document.getElementById('deviceProperties');
        element.innerHTML = 'Test';
    }

    </script>
  </head>
  <body onload="onLoad()">
  <p id="deviceProperties">
  Loading device...
  </p>
  </body>
</html>

Also, i have the cordova-2.6.0.js file in my assets folder. I also tried following the phonegap getting started page for android but those are mostly Mac instructions, nor do they go in much depth. So I followed the phonegap 1.8 instructions with modifications. I'm building on an Android 3.2.1. Any advice?
Reply all
Reply to author
Forward
0 new messages