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
ConnectivityManager manager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
boolean is3g = manager.getNetworkInfo(
ConnectivityManager.TYPE_MOBILE).isConnectedOrConnecting();
boolean isWifi = manager.getNetworkInfo(
ConnectivityManager.TYPE_WIFI).isConnectedOrConnecting();
Log.v("", is3g + " ConnectivityManager Test " + isWifi);
if (!is3g && !isWifi) {
Toast.makeText(
getApplicationContext(),
"Please make sure, your network connection is ON ",
Toast.LENGTH_LONG).show();
}
else {
// Put your function() to go further;
}