get Scan Result Security - Android android.net.wifi

Android examples for android.net.wifi:ScanResult

Description

get Scan Result Security

Demo Code

import android.content.Context;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.util.Log;

public class Main{

    public static String getScanResultSecurity(ScanResult result) {
        final String capabilities = result.capabilities;
        final String[] securityModes = { "WEP", "PSK", "EAP" };

        for (String securityMode : securityModes) {
            if (capabilities.contains(securityMode)) {
                return securityMode;
            }//from w w w.j  a v  a  2 s  .  c  o m
        }

        return "OPEN";
    }

}

Related Tutorials