I'm trying to know the type security of the scanned networks, and i'm getting result like this :
[WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][ESS]
[WPA2-PSK-CCMP][WPS][ESS]
And i used this code :
// Constants used for different security types
public static final String WPA = "WPA";
public static final String WEP = "WEP";
public static final String WPA2 = "WPA2";
public static final String OPEN = "Open";
final String cap = results.get(position).capabilities;
final String[] securityModes = { WEP, WPA, WPA2 };
for (int i = securityModes.length - 1; i >= 0; i--) {
if (cap.toLowerCase().contains(securityModes[i].toLowerCase())) {
textView5.setText(securityModes[i] );
}
else
textView5.setText(OPEN );
}
But i'm just obtaining in textViex :OPEN or WEP , i don't get WPA or WPA2, what could be the problem ?
Try this function :