isuPatches / android-wisefy

Wrapper around WifiManager and ConnectivityManager for Android
Apache License 2.0
312 stars 38 forks source link

Add additional methods to check network capabilities (EAP, PSK, WEP, WPA, and WPA2) #66

Closed jewom closed 7 years ago

jewom commented 7 years ago

Hi,

Is it posible to check if the SSID use WEP or WPA ?

isuPatches commented 7 years ago

Yes...there is...although it also includes PSK.

  public boolean isNetworkSecure(ScanResult scanResult) {
        boolean isSecure = false;
        if (scanResult != null && scanResult.capabilities != null) {
            if (scanResult.capabilities.contains(Capabilities.WEP) || scanResult.capabilities.contains(Capabilities.PSK) || scanResult.capabilities.contains(Capabilities.EAP)) {
                isSecure = true;
            }
        }
        return isSecure;
    }

Is that good enough for your use case?

jewom commented 7 years ago

Hi,

Finally I found a solution by checking myScanResult List nearbyAccessPoints.get(i).capabilities

isuPatches commented 7 years ago

I'll add methods for this in the library :)

isuPatches commented 7 years ago

commit 4afd442f10cff83454d5084d6c326297a2931b6b