Reputation: 9653
In my app I am getting all available WiFi networks and displaying them in a list using WifiManager.startScan()
and WifiManager.getScanResults()
.Also I am able to show signal strength.But I don't know how to show whether wifi is locked or not.In the Settings screen it shows lock icon for wifi which are locked.How can i know whether wifi is password protected?
Upvotes: 4
Views: 2063
Reputation: 16910
An example is: [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP-CCMP][WPS][ESS]
See this answer if you want to find a way of parsing it.
Basically, if you want to get if it is protected or not:
boolean isProtected = AccessPointState.getScanResultSecurity(scanResult) != AccessPointState.OPEN;
(although it is not nice to compare Strings with the == operator, this will always return the correct answer because the reference in AccessPointState is a static final
one)
Upvotes: 4