How to get wifi security type of current wifi network in android

Is there a way to get the Wi-Fi security type of the network the device is connected to. I know that Wi-Fi security can be obtained by scanning the network. but is it possible without scanning so that I can get it for the current wifi network?

+3


source to share


1 answer


You must use ScanResult.capabilities to view your network security type. You can use this without actually scanning the networks by 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);
    }
}

      

+3


source







All Articles