Android examples for Wifi:Wifi SSID
get Current Wifi Config For Ssid
import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.util.Log; import java.net.InetAddress; import java.util.List; public class Main{ private static final String TAG = WifiUtils.class.getSimpleName(); public static Context sContext; private static WifiManager sWifiManager; public static WifiConfigurationWrapper getCurrentWifiConfigForSsid( String ssid) {/*from w w w. jav a 2s . c o m*/ WifiConfigurationWrapper wrapper = null; try { WifiManager wifiManager = getWifiManager(); List<WifiConfiguration> configuredNetworks = wifiManager .getConfiguredNetworks(); for (WifiConfiguration conf : configuredNetworks) { if (conf.SSID.equals(ssid)) { wrapper = new WifiConfigurationWrapper(conf); break; } } } catch (Exception e) { loge(e); } return wrapper; } public static WifiManager getWifiManager() throws Exception { if (sWifiManager == null) { sWifiManager = (WifiManager) sContext .getSystemService(Context.WIFI_SERVICE); } // TODO: throw if we can't use wifiManager (wpa_supplicant isn't ready/running) if (!sWifiManager.isWifiEnabled()) { sWifiManager.setWifiEnabled(true); } return sWifiManager; } public static void loge(String msg) { Log.e(TAG, msg); } public static void loge(String msg, Exception e) { Log.e(TAG, msg, e); } public static void loge(Exception e) { Log.e(TAG, "", e); } }