I have a wifi network SSID and I need to connect to it.
I use this code
WifiConfiguration wifiConfig = new WifiConfiguration();
wifiConfig.SSID = String.format("\"%s\"", ssid);
WifiManager wifiManager = (WifiManager)getSystemService(WIFI_SERVICE);
//remember id
int netId = wifiManager.addNetwork(wifiConfig);
wifiManager.disconnect();
wifiManager.enableNetwork(netId, true);
wifiManager.reconnect();
but Wifi only disconnect and reconnect to the pre-wifi network was previously connected and disconnected.
The wifi network is open without a password. Please advise how to join this wifi network. Thank you