title: Device not detect the online/ offline status
body: <p>In my phonegap application i want to check the device online/offline status.</p>
  
  <pre><code>Cordova version is 3.3
  Android version 4.2.2
  Jquery Mobile 1.3
  </code></pre>
  
  <p>So i use the following methods to detect online/offline.
  Method 1:</p>
  
  <pre><code>document.addEventListener("deviceready",onDeviceReady,false);
  
  function onDeviceReady(){   
      connectionStatusOnline = navigator.onLine ? 'online' : 'offline';
      alert(connectionStatusOnline);
  }
  </code></pre>
  
  <p>it always return <strong>offline</strong>.</p>
  
  <p>Method 2:</p>
  
  <pre><code>document.addEventListener("online", toggleon, false);
      document.addEventListener("offline", toggleoff, false);
  function toggleon() {
      alert("online");
  
  }
  function toggleoff() {
      alert("offline");
  
  }
  </code></pre>
  
  <p>in <strong>method 2 it never calls toogleon or toogleoff</strong>.  </p>
  
  <p>Method 3:</p>
  
  <pre><code>function onDeviceReady() {
  //document.addEventListener("offline", toggleCon, false);
  var networkState = navigator.connection.type;
  
  var states = {};
  states[Connection.UNKNOWN]  = 'Unknown connection';
  states[Connection.ETHERNET] = 'Ethernet connection';
  states[Connection.WIFI]     = 'WiFi connection';
  states[Connection.CELL_2G]  = 'Cell 2G connection';
  states[Connection.CELL_3G]  = 'Cell 3G connection';
  states[Connection.CELL_4G]  = 'Cell 4G connection';
  states[Connection.CELL]     = 'Cell generic connection';
  states[Connection.NONE]     = 'No network connection';
  
  alert('Connection type: ' + states[networkState]);
  }
  </code></pre>
  
  <p>in method 3 it shows <strong>Connection undefined</strong></p>
  
  <p>I have all the plugins in <code>config.xml and set all the permission in manifest</code>.</p>