1

WifiConfiguration conf = 新的 WifiConfiguration(); conf.SSID = "ssid"; conf.preSharedKey = "\"密码\""; conf.status = WifiConfiguration.Status.ENABLED;

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接入点需要用户名+密码才能连接,但我找不到任何设置密码的方法。我认为这是问题所在,因此我无法成功创建它。

请帮助我。非常感谢。

4

1 回答 1

1

你已经设置了 WifiConfiguration.wepKeys

conf.wepKeys[0] = "\"password\"";

是一个很好的例子。

于 2012-01-08T01:54:39.967 回答