The standard PhoneGap API for checking the current network connection (see below) does not seem to update it's result in Ripple Emulator. When I change connection type and execute checkConnection(), it returns the connection type from the first call to this function (at deviceready)
function checkConnection() { // Checks current network status
networkState = navigator.connection.type;
console.log(networkState);
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';
// DEBUG: notify on network state
console.log("Connection type: " + states[networkState]);
}
Is there anything else I need to do (add an event listener?) to get this to work? Normally a device will only fire an event when the status changes from online to offline, but I need to distinguish between 'free' internet and xG connections.