I don\'t want my user to even try downloading something unless they have Wi-Fi connected. However, I can only seem to be able to tell if Wi-Fi is enabled, but they could sti
Try out this method.
public boolean isInternetConnected() {
ConnectivityManager conMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
boolean ret = true;
if (conMgr != null) {
NetworkInfo i = conMgr.getActiveNetworkInfo();
if (i != null) {
if (!i.isConnected()) {
ret = false;
}
if (!i.isAvailable()) {
ret = false;
}
}
if (i == null)
ret = false;
} else
ret = false;
return ret;
}
This method will help to find internet connection available or not.