当我使用以下代码连接到 8open) WLAN 网络时:
WifiConfiguration wifiConfig = new WifiConfiguration();
wifiConfig.BSSID =result.BSSID; // BSSID of detected network
wifiConfig.priority = 1;
wifiConfig.allowedKeyManagement.set(KeyMgmt.NONE);
wifiConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
wifiConfig.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
wifiConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
wifiConfig.status=WifiConfiguration.Status.ENABLED;
int netId = scanData.wifiManager.addNetwork(wifiConfig);
scanData.wifiManager.enableNetwork(netId, true);
...此 WiFi 连接存储在首选网络列表中。所以当我经常尝试时,我会得到一个非常庞大的连接列表——这是我不想要的。
所以我的问题是:我怎样才能暂时建立到 WLAN 网络的连接,而不让 Android 永久存储它?或者有没有办法在不再需要的情况下删除这样的网络?
谢谢!