After reading several other questions/answers, I'm still having an issue using wifiManager.removeNetwork to work.
According to:
and
How to forget a wireless network in android programmatically?
...my code should work:
WifiManager wifiMAN = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
for (WifiConfiguration wifiCon : wifiMAN.getConfiguredNetworks()) {
if (wifiCon.SSID.equals( "\""+ targetNetworkName +"\"")) {
wifiMAN.removeNetwork(wifiCon.networkId)) {
wifiMAN.saveConfiguration();
break;
}
}
However, when I test on API 23 it doesn't work. Looking through the code nothing appears depreciated and the code works on API 21. Anyone have any ideas?