List of utility methods to do Wifi State Check
boolean | isWIFIAvailable(Context context) public static boolean isWIFIAvailable(Context context) This method will check whether WIFI is available or not , if available it will return true else it will return false ConnectivityManager connect = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfoWifi = connect .getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (netInfoWifi.isConnected()) return true; else return false; ... |
boolean | isWifiOnline(Context context) is Wifi Online ConnectivityManager conMan = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); State wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI) .getState(); if (wifi == NetworkInfo.State.CONNECTED) return true; else return false; ... |
boolean | isWifi(Context context) is Wifi ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetInfo = connectivityManager .getActiveNetworkInfo(); if (activeNetInfo != null && activeNetInfo.getType() == ConnectivityManager.TYPE_WIFI) { return true; return false; |
boolean | isWifiEnabled(Context context) is Wifi Enabled ConnectivityManager mgrConn = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
TelephonyManager mgrTel = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
return ((mgrConn.getActiveNetworkInfo() != null && mgrConn
.getActiveNetworkInfo().getState() == NetworkInfo.State.CONNECTED) || mgrTel
.getNetworkType() == TelephonyManager.NETWORK_TYPE_UMTS);
|
boolean | isWifiConnected(Context context) is Wifi Connected if (context != null) { ConnectivityManager mConnectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo mWiFiNetworkInfo = mConnectivityManager .getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (mWiFiNetworkInfo != null) { return mWiFiNetworkInfo.isAvailable() && mWiFiNetworkInfo.isConnected(); ... |
boolean | isWifiConnected(Context context) is Wifi Connected if (context != null) { ConnectivityManager mConnectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo mWiFiNetworkInfo = mConnectivityManager .getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (mWiFiNetworkInfo != null) { return mWiFiNetworkInfo.isAvailable(); return false; |
boolean | checkWiFi(Context inContext) check Wi Fi WifiManager mWifiManager = (WifiManager) inContext .getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = mWifiManager.getConnectionInfo(); int ipAddress = wifiInfo == null ? 0 : wifiInfo.getIpAddress(); if (mWifiManager.isWifiEnabled() && ipAddress != 0) { return true; } else { return false; ... |
boolean | isOnWifi(Context context) is On Wifi WifiManager lWifiManager = (WifiManager) context
.getSystemService(Context.WIFI_SERVICE);
return lWifiManager == null ? false : lWifiManager.isWifiEnabled()
&& lWifiManager.getConnectionInfo() != null
&& lWifiManager.getConnectionInfo().getIpAddress() != 0;
|
boolean | wifiEnable(Context context) wifi Enable return NETWORK_CLASS_WIFI == getConnectedType(context);
|
boolean | isWifi(Context mContext) is Wifi ConnectivityManager connectivityManager = (ConnectivityManager) mContext .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetInfo = connectivityManager .getActiveNetworkInfo(); if (activeNetInfo != null && activeNetInfo.getTypeName().equals("WIFI")) { return true; return false; |