I need to detect in android if there is any connection Wifi
or 3G
( or 3G+
) or EDGE
in android. When there is an connecti
First get a reference to the ConnectivityManager and then check the Wifi and 3G status of the device. You'll need the ACCESS_NETWORK_STATE permission to use this service.
ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
NetworkInfo mMobile = connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
if (mWifi.isAvailable() == true) {
return "Connected to WiFi";
} else if (mMobile.isAvailable() == true) {
return "Connected to Mobile Network";
} else return "No internet Connection"