0
夥計們,我需要一隻手在這裏..我一直在這個問題上工作了幾天,現在我非常絕望。WifiManager做奇怪的事情(Android)
我開發了一個Android應用程序,用於查找以某些前綴(例如MyWifi_)開頭的無線網絡。如果它找到一個包含這個前綴的網絡,它會嘗試建立一個連接。
問題是,在某些設備中,它連接,但在其他設備中,它創建了網絡,但從未連接。該接入點總是具有以下配置:
netConfig = new WifiConfiguration();
netConfig.SSID = "my_prefix" + USER_NICK;
netConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
netConfig.status = WifiConfiguration.Status.ENABLED;
netConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
netConfig.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
和我的連接代碼:
WifiConfiguration wc = new WifiConfiguration();
wc.SSID = "\"" + network.SSID + "\""; //'network' is the found network
wc.BSSID = network.BSSID;
wc.priority=1;
wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
wc.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
wc.status = WifiConfiguration.Status.ENABLED;
int netId = wifi.addNetwork(wc); <---this is working fine... it adds the network
wifi.enableNetwork(netId, true);
有什麼毛病我WifiConfiguration?我試着改變了幾個東西(WEP,WPA,OPEN,只通過BSSID連接),但似乎沒有解決我的問題。你有沒有任何WifiConfiguration一直爲你工作(作爲接入點和客戶端)?
謝謝