I have implemented the system to connect to wifi networks from my app programmatically, now I want to forget configured WIFI networks programmatically from the application.
I have implemented this into my application already and its been working fine on the Android 5.0 and lower devices (Less then API 22).
For Android 6.0 and the higher device it is not working (Higher and equal then API 23).
Please refer the following code:
val wifiManager = [email protected]!!.getSystemService(android.content.Context.WIFI_SERVICE) as WifiManager
val list = wifiManager.configuredNetworks
for (i in list) {
wifiManager.disableNetwork(i.networkId)
wifiManager.saveConfiguration()
}
I have also referred the following link: https://mcmap.net/q/502181/-android-m-unable-to-remove-wifi-ap-programmatically
As there are some changes in WIFI configurations in Android 6.0.
Please, help me if anyone has solution for this on Android 6.0 onwards.