title: deviceready not firing in phonegap
body: <p>I realize that similar questions have been asked but none of the solutions posted have worked for me, so maybe my situation is a bit different. I am using Phonegap and JQuery Mobile together. I have included cordova.js as per the instructions in my index.html:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Convo&lt;/title&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1" /&gt;
  
      &lt;link rel="stylesheet" href="jquery_mobile/jquery.mobile-1.4.2.min.css" /&gt;
      &lt;link rel="stylesheet" href="owl/owl-carousel/owl.carousel.css"&gt;
      &lt;link rel="stylesheet" href="owl/owl-carousel/owl.theme.css"&gt;
      &lt;link rel="stylesheet" href="owl/home_slider.css"&gt;
      &lt;link rel="stylesheet" href="css/convo.min.css" /&gt;
  
      &lt;script src="jquery/jquery.js"&gt;&lt;/script&gt;
      &lt;script src="owl/owl-carousel/owl.carousel.js"&gt;&lt;/script&gt;
      &lt;script src="javascript/owl_effects.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" charset="utf-8" src="cordova.js"&gt;&lt;/script&gt;
      &lt;script src="jquery_mobile/jquery.mobile-1.4.2.min.js"&gt;&lt;/script&gt;
      &lt;script src="quickblox/quickblox.js"&gt;&lt;/script&gt;
      &lt;script src="javascript/controller.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
      &lt;div data-role="page" id="home"&gt;    
          &lt;div id="owl-demo" class="owl-carousel owl-theme"&gt;
              &lt;div class="item"&gt;&lt;img src="images/space1.jpg" alt="The Last of us"&gt;&lt;/div&gt;
              &lt;div class="item"&gt;&lt;img src="images/space2.jpg" alt="GTA V"&gt;&lt;/div&gt;
              &lt;div class="item"&gt;&lt;img src="images/space3.jpg" alt="Mirror Edge"&gt;&lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div role="main" class="ui-content"&gt;
              &lt;label for="user_login"&gt;Email:&lt;/label&gt;
              &lt;input type="email" name="name" id="user_login" data-clear-btn="true" value=""&gt;
              &lt;label for="user_password"&gt;Password:&lt;/label&gt;
              &lt;input type="password" name="name" id="user_password" data-clear-btn="true" value=""&gt;
              &lt;input type="button" value="Sign In" onclick="home_signin_clicked()"&gt;
              &lt;input type="button" value="Join!" onclick="home_join_clicked()"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>In an attached Javascript, I have a listener for the deviceready event. I am not sure if document.ready() is somehow interfering with it:</p>
  
  <pre><code>$(function() 
  { //shorthand document.ready function
  document_ready = true;
  
  stored_view = localStorage.getItem("view");
  
  if(!stored_view)
  {
      //home
      change_view("home");
  }
  else if(stored_view != view)
  {
      //go to stored view
      change_view(stored_view);
  }
  
  });
  
  function device_is_ready()
  {
  phonegap_ready = true;
  
  if(navigator.network.connection.type == Connection.NONE ||  navigator.network.connection.type == Connection.UNKNOWN)
  {
      online = false;
      alert("offline");
  }
  else
  {
      online = true;
      alert("online");
  }
  }
  
  document.addEventListener("deviceready", device_is_ready, true);
  </code></pre>
  
  <p>So far, I've tried defining the function inside of the addEventListener, amd I've tried attaching the listener inside the document.ready(). Neither solution worked. The weird thing is that I have had this same set up for weeks and never had a problem. I should mention that I'm using Adobe build to make the APK (i'm using Android). Any ideas?</p>
  
  <p>Edit: Here is my entire config.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;!-- config.xml reference: https://build.phonegap.com/docs/config-xml --&gt;
  &lt;widget xmlns     = "http://www.w3.org/ns/widgets"
      xmlns:gap = "http://phonegap.com/ns/1.0"
      id        = "com.phonegap.hello-world"
      version   = "1.0.0"&gt;
  
  &lt;name&gt;Convo&lt;/name&gt;
  
  &lt;description&gt;
      App Prototype
  &lt;/description&gt;
  
  &lt;author href="http://phonegap.com" email="support@phonegap.com"&gt;
      PhoneGap Team
  &lt;/author&gt;
  
  &lt;!--
      If you do not want any permissions to be added to your app, add the
      following tag to your config.xml; you will still have the INTERNET
      permission on your app, which PhoneGap requires.
  --&gt;
  &lt;preference name="permissions"                value="none"/&gt;
  
  &lt;!-- Customize your app and platform with the preference element. --&gt;
  &lt;preference name="phonegap-version"           value="3.4.0" /&gt;          &lt;!-- all: current version of PhoneGap --&gt;
  &lt;preference name="orientation"                value="default" /&gt;        &lt;!-- all: default means both landscape and portrait are enabled --&gt;
  &lt;preference name="target-device"              value="universal" /&gt;      &lt;!-- all: possible values handset, tablet, or universal --&gt;
  &lt;preference name="fullscreen"                 value="false" /&gt;           &lt;!-- all: hides the status bar at the top of the screen --&gt;
  &lt;preference name="webviewbounce"              value="true" /&gt;           &lt;!-- ios: control whether the screen 'bounces' when scrolled beyond the top --&gt;
  &lt;preference name="prerendered-icon"           value="true" /&gt;           &lt;!-- ios: if icon is prerendered, iOS will not apply it's gloss to the app's icon on the user's home screen --&gt;
  &lt;preference name="stay-in-webview"            value="false" /&gt;          &lt;!-- ios: external links should open in the default browser, 'true' would use the webview the app lives in --&gt;
  &lt;preference name="ios-statusbarstyle"         value="black-opaque" /&gt;   &lt;!-- ios: black-translucent will appear black because the PhoneGap webview doesn't go beneath the status bar --&gt;
  &lt;preference name="detect-data-types"          value="true" /&gt;           &lt;!-- ios: controls whether data types (such as phone no. and dates) are automatically turned into links by the system --&gt;
  &lt;preference name="exit-on-suspend"            value="false" /&gt;          &lt;!-- ios: if set to true, app will terminate when home button is pressed --&gt;
  &lt;preference name="show-splash-screen-spinner" value="true" /&gt;           &lt;!-- ios: if set to false, the spinner won't appear on the splash screen during app loading --&gt;
  &lt;preference name="auto-hide-splash-screen"    value="true" /&gt;           &lt;!-- ios: if set to false, the splash screen must be hidden using a JavaScript API --&gt;
  &lt;preference name="disable-cursor"             value="false" /&gt;          &lt;!-- blackberry: prevents a mouse-icon/cursor from being displayed on the app --&gt;
  &lt;preference name="android-minSdkVersion"      value="7" /&gt;              &lt;!-- android: MIN SDK version supported on the target device. MAX version is blank by default. --&gt;
  &lt;preference name="android-installLocation"    value="auto" /&gt;           &lt;!-- android: app install location. 'auto' will choose. 'internalOnly' is device memory. 'preferExternal' is SDCard. --&gt;
  
  &lt;!-- Plugins --&gt;
  
  &lt;!-- Core plugins --&gt;
  &lt;gap:plugin name="org.apache.cordova.battery-status" /&gt;
  &lt;gap:plugin name="org.apache.cordova.camera" /&gt;
  &lt;gap:plugin name="org.apache.cordova.media-capture" /&gt;
  &lt;gap:plugin name="org.apache.cordova.console" /&gt;
  &lt;gap:plugin name="org.apache.cordova.contacts" /&gt;
  &lt;gap:plugin name="org.apache.cordova.device" /&gt;
  &lt;gap:plugin name="org.apache.cordova.device-motion" /&gt;
  &lt;gap:plugin name="org.apache.cordova.device-orientation" /&gt;
  &lt;gap:plugin name="org.apache.cordova.dialogs" /&gt;
  &lt;gap:plugin name="org.apache.cordova.file" /&gt;
  &lt;gap:plugin name="org.apache.cordova.file-transfer" /&gt;
  &lt;gap:plugin name="org.apache.cordova.geolocation" /&gt;
  &lt;gap:plugin name="org.apache.cordova.globalization" /&gt;
  &lt;gap:plugin name="org.apache.cordova.inappbrowser" /&gt;
  &lt;gap:plugin name="org.apache.cordova.media" /&gt;
  &lt;gap:plugin name="org.apache.cordova.network-information" /&gt;
  &lt;gap:plugin name="org.apache.cordova.splashscreen" /&gt;
  &lt;gap:plugin name="org.apache.cordova.vibration" /&gt;
  
  &lt;!-- Third party plugins --&gt;
  &lt;!-- A list of available plugins are available at https://build.phonegap.com/plugins --&gt;
  &lt;!--
      &lt;gap:plugin name="com.phonegap.plugins.barcodescanner" /&gt;
  --&gt;
  
  &lt;!-- Define app icon for each platform. This is a relative path to config.xml.
      For e.g. if you place an icon.png inside res folder, you should modify the
      src in the following setting to "res/icon.png" --&gt;
  &lt;icon src="icon.png" /&gt;
  &lt;icon src="res/icon/android/icon-36-ldpi.png"   gap:platform="android"    gap:qualifier="ldpi" /&gt;
  &lt;icon src="res/icon/android/icon-48-mdpi.png"   gap:platform="android"    gap:qualifier="mdpi" /&gt;
  &lt;icon src="res/icon/android/icon-72-hdpi.png"   gap:platform="android"    gap:qualifier="hdpi" /&gt;
  &lt;icon src="res/icon/android/icon-96-xhdpi.png"  gap:platform="android"    gap:qualifier="xhdpi" /&gt;
  &lt;icon src="res/icon/blackberry/icon-80.png"     gap:platform="blackberry" /&gt;
  &lt;icon src="res/icon/blackberry/icon-80.png"     gap:platform="blackberry" gap:state="hover"/&gt;
  &lt;icon src="res/icon/ios/icon-57.png"            gap:platform="ios"        width="57" height="57" /&gt;
  &lt;icon src="res/icon/ios/icon-72.png"            gap:platform="ios"        width="72" height="72" /&gt;
  &lt;icon src="res/icon/ios/icon-57-2x.png"         gap:platform="ios"        width="114" height="114" /&gt;
  &lt;icon src="res/icon/ios/icon-72-2x.png"         gap:platform="ios"        width="144" height="144" /&gt;
  &lt;icon src="res/icon/webos/icon-64.png"          gap:platform="webos" /&gt;
  &lt;icon src="res/icon/windows-phone/icon-48.png"  gap:platform="winphone" /&gt;
  &lt;icon src="res/icon/windows-phone/icon-173.png" gap:platform="winphone"   gap:role="background" /&gt;
  
  &lt;!-- Define app splash screen for each platform. --&gt;
  &lt;gap:splash src="res/screen/android/screen-ldpi-portrait.png"       gap:platform="android" gap:qualifier="port-ldpi" /&gt;
  &lt;gap:splash src="res/screen/android/screen-mdpi-portrait.png"       gap:platform="android" gap:qualifier="port-mdpi" /&gt;
  &lt;gap:splash src="res/screen/android/screen-hdpi-portrait.png"       gap:platform="android" gap:qualifier="port-hdpi" /&gt;
  &lt;gap:splash src="res/screen/android/screen-xhdpi-portrait.png"      gap:platform="android" gap:qualifier="port-xhdpi" /&gt;
  &lt;gap:splash src="res/screen/blackberry/screen-225.png"              gap:platform="blackberry" /&gt;
  &lt;gap:splash src="res/screen/ios/screen-iphone-portrait.png"         gap:platform="ios"     width="320" height="480" /&gt;
  &lt;gap:splash src="res/screen/ios/screen-iphone-portrait-2x.png"      gap:platform="ios"     width="640" height="960" /&gt;
  &lt;gap:splash src="res/screen/ios/screen-iphone-portrait-568h-2x.png" gap:platform="ios"     width="640" height="1136" /&gt;
  &lt;gap:splash src="res/screen/ios/screen-ipad-portrait.png"           gap:platform="ios"     width="768" height="1024" /&gt;
  &lt;gap:splash src="res/screen/ios/screen-ipad-landscape.png"          gap:platform="ios"     width="1024" height="768" /&gt;
  &lt;gap:splash src="res/screen/windows-phone/screen-portrait.jpg"      gap:platform="winphone" /&gt;
  
  &lt;!--
      Define access to external domains.
  
      &lt;access /&gt;            - a blank access tag denies access to all external resources.
      &lt;access origin="*" /&gt; - a wildcard access tag allows access to all external resource.
  
      Otherwise, you can specify specific domains:
  --&gt;
  &lt;access origin="*"/&gt;
  &lt;!--
      &lt;access origin="http://phonegap.com" /&gt;                    - allow any secure requests to http://phonegap.com/
      &lt;access origin="http://phonegap.com" subdomains="true" /&gt;  - same as above, but including subdomains, such as http://build.phonegap.com/
      &lt;access origin="http://phonegap.com" browserOnly="true" /&gt; - only allows http://phonegap.com to be opened by the child browser.
  --&gt;
  
  &lt;/widget&gt;
  </code></pre>