在我的应用中,我正在通过wifi连接到自定义设备。基本上,一切正常,如果我打开设备应用程序,它将自动与其连接。但是,某些设备不希望自动连接。是某种安全策略吗?
这是我的代码中处理连接的一部分:
static private WifiConfiguration getWifiApConfiguration(String serialNumber, String password) {
WifiConfiguration wc = new WifiConfiguration();
wc.SSID = serialNumber;
wc.preSharedKey = "\"" + encryptPassword(password) + "\"";
wc.status = WifiConfiguration.Status.ENABLED;
wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
wc.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
wc.allowedProtocols.set(WifiConfiguration.Protocol.WPA);
wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
return wc;
}
我试图检查手机的睡眠模式并重新连接选项,但一切似乎都还可以。我发现例如在手机上存在该问题:
Huawei OS v6.0 - Android security patch level 1st May 2016 - EMUI 4.1 HTC OS v6.0.1 - Android security patch level 1st May 2017 - HTC Sense version 7.0 - Software no 2.10.69.12 Samsung S6 Edge Os v7.0 - Android security patch level 1st March 2018
有人知道为什么这些手机不想重新连接吗?我可以改善一些东西吗?预先感谢。