I implemented a system for programmatically connecting to Wi-Fi networks from my application, now I want to forget about the Wi-Fi networks settings programmatically from the application.
I have already implemented this in my application, and it works great on Android 5.0 and lower devices (less API 22).
For Android 6.0 and higher, the device does not work (higher and equal to API 23).
Please use the following code:
val wifiManager = this@SelectWifiSettingsActivity.baseContext!!.getSystemService(android.content.Context.WIFI_SERVICE) as WifiManager
val list = wifiManager.configuredNetworks
for (i in list) {
wifiManager.disableNetwork(i.networkId)
wifiManager.saveConfiguration()
}
I also referred to the following link: stack overflow
There are also some changes in WIFI configurations in Android 6.0.
Please help me if anyone has a solution for this on Android 6.0 and above.
source
share