I am using phonegap for my app. My app is basicaly for RSS_FEED from one website.
but my requirement is when internet is not there application should alert
-
please follow the phonegap documentation.
You could also change the given function to return true or false:
function checkConnection() {
var networkState = navigator.connection.type;
var states = {};
states[Connection.UNKNOWN] = false;
states[Connection.ETHERNET] = true;
states[Connection.WIFI] = true;
states[Connection.CELL_2G] = true;
states[Connection.CELL_3G] = true;
states[Connection.CELL_4G] = true;
states[Connection.CELL] = true;
states[Connection.NONE] = false;
if (states[networkState]) {
return true;
} else {
return false;
}
}