title: how to fire my online and offline events
body: <p>I'm working with cordova 3.4. (android)</p>
  
  <p>I set 4 events to fire that are : </p>
  
  <ul>
  <li>deviceready</li>
  <li>onResume</li>
  <li>online</li>
  <li>offline</li>
  </ul>
  
  <p>the problem is that online and offline events are not firing at all.</p>
  
  <p>according to the documentation, i set the onResume's listener before the deviceready and online/offline after it.</p>
  
  <p>here is what i did.</p>
  
  <p>script for the events :</p>
  
  <pre><code>function onLoad() {
  document.addEventListener("online", onGoesOnLine, false);
  document.addEventListener("offline", onGoesOffLine, false);
  document.addEventListener("deviceready", onDeviceReady, false);
  }
  
  function onDeviceReady() {
  document.addEventListener("resume", onResumeApp, false);
  var db = window.openDatabase("Database", "1.0", "MondialRelay", 200000);
  db.transaction(creerBaseDonneesSiNonExist, function(err){
  console.log("erf ...");
   }, function(){
    console.log("hell yeah");
   });
  }
  
  function onGoesOnLine(){
   alert("onLine");
  }
  
  function onGoesOffLine(){
   alert("offLine");
  }
  
  function onResumeApp(){
   alert("onResume");
   window.location = "offLineIndex.html";
  }
  </code></pre>
  
  <p>config.xml : </p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;widget id="fr.mondialrelay.appli" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"&gt;
  &lt;preference name="loglevel" value="DEBUG" /&gt;
  &lt;feature name="App"&gt;
      &lt;param name="android-package" value="org.apache.cordova.App" /&gt;
  &lt;/feature&gt;
  &lt;name&gt;MondialRelay&lt;/name&gt;
  &lt;description&gt;
  &lt;/description&gt;
  &lt;author email="dev@cordova.apache.org" href="http://cordova.io"&gt;
  &lt;/author&gt;
  &lt;content src="index.html" /&gt;
  &lt;access origin="*" /&gt;
  &lt;feature name="NetworkStatus"&gt;
      &lt;param name="android-package" value="org.apache.cordova.networkinformation.NetworkManager" /&gt;
  &lt;/feature&gt;
  &lt;feature name="Device"&gt;
      &lt;param name="android-package" value="org.apache.cordova.device.Device" /&gt;
  &lt;/feature&gt;
  &lt;feature name="Geolocation"&gt;
      &lt;param name="android-package" value="org.apache.cordova.geolocation.GeoBroker" /&gt;
  &lt;/feature&gt;
  &lt;feature name="Battery"&gt;
      &lt;param name="android-package" value="org.apache.cordova.batterystatus.BatteryListener" /&gt;
  &lt;/feature&gt;
  &lt;plugin name="Storage" value="org.apache.cordova.Storage" /&gt;
  &lt;plugin name="Geolocation" value="org.apache.cordova.GeoBroker" /&gt;
  &lt;plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager" /&gt;
  &lt;/widget&gt;
  </code></pre>
  
  <p>AndroidManifest.xml :</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="fr.mondialrelay.appli" xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" /&gt;
  &lt;application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name"&gt;
      &lt;activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="MondialRelay" android:theme="@android:style/Theme.Black.NoTitleBar"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  &lt;uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /&gt;
  &lt;uses-permission android:name="android.permission.BROADCAST_STICKY" /&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>here is what i see when i run the "cordova plugin ls" command:</p>
  
  <pre><code>[ 'org.apache.cordova.battery-status',
  'org.apache.cordova.device',
  'org.apache.cordova.geolocation',
  'org.apache.cordova.network-information' ]
  </code></pre>
  
  <p>i don't think i'm missing anything but still it doesn't work ...</p>
  
  <p>i know this question's has been asked many times already but even after reading the answers, i can't figure out how to make it work.</p>
  
  <p>First, when i was testing i was putting the app as pause state to cut off my internet connexion, i thought that could be the problem .. i then set up a wifi with my phone and then, while the application running, i just shut it down .. no way to get any alert ..</p>
  
  <p>thank you for helping ;)
  regards.</p>