4 Replies Latest reply on Mar 7, 2017 11:14 AM by cote.jp

    The "deviceready" event does not seem to be firing...

    cote.jp

      Phonegap Build newbie here.

       

      When I launch my app on my Android 6.0.1 tablet, it does not start (because deviceready event does not fire). When I test it in Ripple, it works fine. It also works fine if I don't listen to the deviceready event and simply call my code on load.

       

      Everybody says I should be listening to deviceready, why isn't it working?

       

      My script is linked in header of my html file. I call my script's init() function from the body's load event: <body onload="init();">

       

      My init() function looks like this:

       

      function init() {

       

        if (navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|IEMobile)/)) {

         console.log("Mobile!");
         document.addEventListener("deviceready", start, false);
        } else {

         console.log("Desktop!");
         start();
        }

       

      }

       

      On the tablet, the start() function is never called.

       

      P.S. As per the Phonegap Build's instruction, I am not including phonegap.js or cordova.js.

       

      What am I doing wrong?