Always getting -1 in adding new wifiConfiguration to the wifiiManager
I am creating a list of in-range wifis and show it to the user. I want to the user can select each of the items in the list and insert the password in order to connect to the selected SSID. I wrote this method for wifi connection: private WifiConfiguration wifiConf; /* WifiConfiguration object */ private WifiManager wifiMgr; /* WifiManager object */ private WifiInfo wifiInfo; /* WifiInfo object */ public boolean connectToSelectedNetwork(String networkSSID, String networkPassword, String securityType) { int networkId; int SecurityProtocol; if (securityType.contains("WEP")) { SecurityProtocol =