kwiky/kwikdroid — Issue #1: Check if network is available
Author: kwiky
Created: 2012-02-17 15:08:43+00:00
State: open

public boolean isOnline() {
ConnectivityManager cm =
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnectedOrConnecting()) {
return true;
}
return false;
}

with permissions :