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
I simply use the following:
SupplicantState supState;
wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
supState = wifiInfo.getSupplicantState();
Which will return one of these states at the time you call getSupplicantState();
ASSOCIATED - Association completed.
ASSOCIATING - Trying to associate with an access point.
COMPLETED - All authentication completed.
DISCONNECTED - This state indicates that client is not associated, but is likely to start looking for an access point.
DORMANT - An Android-added state that is reported when a client issues an explicit DISCONNECT command.
FOUR_WAY_HANDSHAKE - WPA 4-Way Key Handshake in progress.
GROUP_HANDSHAKE - WPA Group Key Handshake in progress.
INACTIVE - Inactive state.
INVALID - A pseudo-state that should normally never be seen.
SCANNING - Scanning for a network.
UNINITIALIZED - No connection.