Page 1 of 1

Connection Type Undefined

Posted: Sun Jan 13, 2013 5:05 pm
by Joe Bohen

Hi,

I am using the sample function provided by Cordova to test the connection. When I invoke the function I get 'Undefined' returned I am testing on Android 2.2.1 what is the issue here?

Cordova sample code:

function checkConnection() {
var networkState = navigator.connection.type;

Code: Select all

 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.NONE]     = 'No network connection'; 

 alert('Connection type: ' + states[networkState]); 

}


Connection Type Undefined

Posted: Sun Jan 13, 2013 5:34 pm
by Essay Writing Service

navigator.network.connection.type is correct.


Connection Type Undefined

Posted: Sun Jan 13, 2013 7:43 pm
by Joe Bohen

Hi Veripuu,

Thanks for the assistance that has don the trick.

regards,
Joe


Connection Type Undefined

Posted: Tue Feb 19, 2013 2:26 pm
by Winetou

Hi Veripuu,
under ios 5 and cordova 2.3.0 is the connection.type undefined!

regards,
Wintou