该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
private int getNetWorkId(){
//判断是否已经连接过,如果已经连接,直接返回网络ID
List configs = wifiMgr.getConfiguredNetworks();
for (WifiConfiguration config : configs) {
if (config.SSID.replace("\"","").equals(BedUtils.DEVICE_SSID)) {
return config.networkId;
}
}
WifiConfiguration config = new WifiConfiguration();
config.allowedAuthAlgorithms.clear();
config.allowedGroupCiphers.clear();
config.allowedKeyManagement.clear();
config.allowedPairwiseCiphers.clear();
config.allowedProtocols.clear();
config.SSID = "\"" + BedUtils.DEVICE_SSID + "\"";
config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
int rid = wifiMgr.addNetwork(config);
return rid;
}