title: device.platform return 'device is not defined' on cordova project
body: <p>I've a problem that happens randomly when I run my cordova android application. Basically the "device" sometime is null and sometime not. I dunno why it happens, this is the first portion of my code:</p>
  
  <p><strong>app.js</strong></p>
  
  <pre><code>app = {
  
      // deviceready Event Handler
      onDeviceReady: function() {
  
          try
          {           
              var devicePlatform = device.platform;
              var deviceVersion = device.version;     
          }
          catch(e)
          {
              alert("Error: "+e)
          }
  
          ....
      }
  }
  </code></pre>
  
  <p><strong>index.html</strong></p>
  
  <pre><code>....
      &lt;/div&gt;
  
      &lt;script src="cordova.js"&gt;&lt;/script&gt;
      &lt;script src="js/libs/openfb.js"&gt;&lt;/script&gt;
      &lt;script src="js/app.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          $(document).on("mobileinit", function() {
              $.mobile.ajaxEnabled = true;
              $.mobile.linkBindingEnabled = true;
              $.mobile.defaultPageTransition = "fade";
              $.mobile.phonegapNavigationEnabled = true;
              $.mobile.allowCrossDomainPages = true;   
          });
  
          // init application
          $(window).load(function() {
              $(document).bind('deviceready', app.onDeviceReady());   
          });
      &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The device plugin was outdated so I obtained the new version, 0.3.0 but the bug is still there. Any hints?</p>