title: PhoneGap: ReferenceError: Connection is not defined
body: <p>I'm busy learning PhoneGap and building an application for Android.</p>
  
  <p>Got the basic my-app with device ready working fine.</p>
  
  <p>Now I'm trying to test the network connection with no success.</p>
  
  <p>I installed the plugin-network-information:</p>
  
  <pre><code>$ cordova plugin add org.apache.cordova.network-information&lt;br&gt;
  $ phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git&lt;br&gt;
  </code></pre>
  
  <p>Added feature to config.xml:</p>
  
  <pre><code>&lt;feature name="NetworkStatus"&gt;
  &lt;param name="android-package" value="org.apache.cordova.networkinformation.NetworkManager" /&gt;
  &lt;/feature&gt;
  </code></pre>
  
  <p>All OK.</p>
  
  <p>When I do a </p>
  
  <pre><code>$ phonegap local build android
  </code></pre>
  
  <p>It builds the app fine.
  When I open the built AndroidManifest.xml file, the following entry is there:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; 
  </code></pre>
  
  <p>When I run the app, I get a "ReferenceError: Connection is not defined"</p>
  
  <p>Here is my code, I got this from <a href="http://docs.phonegap.com/en/edge/cordova_connection_connection.md.html#Connection" rel="nofollow">PhoneGap</a>:</p>
  
  <pre><code>try {
  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]);
  } catch (e) {
  alert(e);
  }
  </code></pre>
  
  <p>Has anyone had the same problem and hopefully a solution?</p>