1
WifiConfiguration conf = new WifiConfiguration(); conf.SSID =「ssid」; conf.preSharedKey =「\」密碼\「」; conf.status = WifiConfiguration.Status.ENABLED;如何創建Android Wifi配置並使用用戶名/密碼訪問wifi
conf.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
conf.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
conf.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
conf.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
conf.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
conf.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
conf.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
conf.allowedProtocols.set(WifiConfiguration.Protocol.WPA);
conf.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
int res = wifi.addNetwork(conf);
boolean b = wifi.enableNetwork(res, true);
這WiFi接入點需要用戶名+密碼連接到,但我找不到任何方式將密碼設置爲它。我認爲這是問題,所以我不能成功創建它。
請幫我解決這個問題。非常感謝。
感謝這麼好的鏈接。 – swiftBoy 2012-07-10 12:40:07