Android - connecting to Wifi without security regulations (no WEP/WPA/WPA2)
I tried to establish a connection to an unsecured Access point, but it always creates a new profile with WPA2.
ap_ssid = "\"AP_SSID\"";
wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if开发者_如何转开发 (!wifiManager.isWifiEnabled()) {
wifiManager.setWifiEnabled(true);
}
config = new WifiConfiguration();
config.SSID = ap_ssid;
config.status = WifiConfiguration.Status.ENABLED;
int netID = wifiManager.addNetwork(config);
wifiManager.enableNetwork(netID, true);
config.allowedKeyManagement.set(KeyMgmt.NONE);
精彩评论