Android, Automatically Connecting To Wifi Networks That Have No Internet Access
I'm calling the function WifiManager.addNetwork(WifiConfiguration) to try and add an adhoc wifi network to the device's wifi configurations. But on Android M this function returns
Solution 1:
You need to enable the network after that :
List<WifiConfiguration> list = wifiManager.getConfiguredNetworks();
for( WifiConfiguration i : list ) {
if(i.SSID != null && i.SSID.equals("\"" + ssid + "\"")) {
wifiManager.disconnect();
wifiManager.enableNetwork(i.networkId, true);
wifiManager.reconnect();
enter code here
break;
}
}
Post a Comment for "Android, Automatically Connecting To Wifi Networks That Have No Internet Access"