如何通过Android切换相同的SSID(不同的BSSID)wifi网络? 我总是连接旧的BSSID wifi AP。
我的代码如下:
wifiManager.disconnect();
do{
Thread.sleep(200);
Log.e(TAG,"wifiManager.isWifiEnabled()");
}while(!wifiManager.isWifiEnabled());
int networkId_Old = wifiManager.getConnectionInfo().getNetworkId();
wifiManager.disableNetwork(networkId_Old);
wifiManager.removeNetwork(networkId_Old);
wifiManager.saveConfiguration();
int networkId = wifiManager.addNetwork(NEW_wifiConfig);
if (networkId == -1)
return false;
if (!wifiManager.saveConfiguration())
return false;
wifiManager.enableNetwork(networkId, true);