WifiManager mWifiManager=(WifiManager)getSystemService(Context.WIFI_SERVICE);


WifiManager mWifiManager=(WifiManager)getSystemService(Context.WIFI_SERVICE);


List mWifiConfigurations = mWifiManager.getConfiguredNetworks();
for (WifiConfiguration mWifiConfiguration : mWifiConfigurations) {
if (mWifiConfiguration.SSID.equals("\"free\"")) {
int indexSSID = mWifiManager.addNetwork(mWifiConfiguration);
boolean isConnected = mWifiManager.enableNetwork(mWifiManager.getConfiguredNetworks().get(indexSSID).networkId, false);
if(isConnected){

}
}
}

你可能感兴趣的:(WifiManager mWifiManager=(WifiManager)getSystemService(Context.WIFI_SERVICE);)