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);

この Wi-Fi アクセス ポイントに接続するにはユーザー名とパスワードが必要ですが、パスワードを設定する方法が見つかりません。これが問題で、うまく作成できないと思います。

これについて私を助けてください。どうもありがとう。

4

1 に答える 1

1

WifiConfiguration.wepKeysを設定しました

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

これは本当に良い例です。

于 2012-01-08T01:54:39.967 に答える