Note that there are some explanatory texts on larger screens.

plurals
  1. POcordova 3.0: Android: Connection is not defined
    primarykey
    data
    text
    <p>my first time experimenting with Apache Cordova 3.0. </p> <p>downloaded lib, unziped cordova-android and cordova-js and created a project:</p> <pre><code>./create ~/Documents/andriod-projects/HelloWorld com.x.HelloWorld HelloWorld - OK </code></pre> <p>res/xml/config.xml</p> <pre><code>&lt;plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager" /&gt; </code></pre> <p>AndroidManifest.xml</p> <pre><code>&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.READ_PHONE_STATE" /&gt; </code></pre> <p>on index.js device ready:</p> <pre><code>bindEvents: function() { document.addEventListener('deviceready', this.onDeviceReady, false); }, onDeviceReady: function() { 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("Network: "+states[networkState]); } </code></pre> <p>when I emulate the project on my andriod I got in LogCat <code>Error:Connection is not defined</code>:</p> <p><img src="https://i.stack.imgur.com/xS8Qv.png" alt="enter image description here"></p> <p>what I am missing? I have to attach a .js in order to Connection be declared?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload