Check WIFI connection
ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
boolean wifiConnected = mWifi.isConnected();
This permission is necessary:
android.permission.ACCESS_NETWORK_STATE
Written by José Manuel Pereira (JMPergar)
Related protips
1 Response
I have here this other snippet for check if exist one active and connected only.
private boolean isNetworkEnabled() {
ConnectivityManager conMgr = (ConnectivityManager) mActivity.getSystemService(
Context.CONNECTIVITY_SERVICE);
NetworkInfo i = conMgr.getActiveNetworkInfo();
if (i == null || !i.isConnected() || !i.isAvailable()) {
return false;
}
return true;
}
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Android
Authors
Related Tags
#android
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#