Reputation: 1005
Is there a way to obtain the wifi security type of the network that the device is currently connected. I know that wifi security could be obtained by scanning network. but is it possible without scanning so that I can get it for the current wifi network??
Upvotes: 4
Views: 2126
Reputation: 614
You need to use the ScanResult.capabilities to see the security type of a network. You can use this without actually scanning for networks, using something like:
WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
List<ScanResult> networkList = wifi.getScanResults();
if (networkList != null) {
for (ScanResult network : networkList)
{
String Capabilities = network.capabilities;
Log.w (TAG, network.SSID + " capabilities : " + Capabilities);
}
}
Upvotes: 3