is SSID Exists - Android android.net.wifi

Android examples for android.net.wifi:Wifi SSID

Description

is SSID Exists

Demo Code

import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.util.Log;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;

public class Main{

    private static WifiConfiguration isExists(WifiManager wifiManager,
            String ssid) {//from w  w w .ja  v  a 2s . c  o m
        List<WifiConfiguration> configs = wifiManager
                .getConfiguredNetworks();
        if (configs != null) {
            for (WifiConfiguration config : configs) {
                if (config.SSID.equals("\"" + ssid + "\"")) {
                    return config;
                }
            }
        }
        return null;
    }

}

Related Tutorials