Home » Android » Android 10 (API29) connecting via ConnectivityManager caches password and fails-Exceptionshub

Android 10 (API29) connecting via ConnectivityManager caches password and fails-Exceptionshub

Posted by: admin February 26, 2020 Leave a comment

Questions:

I’ve implemented connection to a IoT device via WiFi access point it’s providing.
I’m using requestNetwork method of ConnectivityManager and I’m providing WifiNetworkSpeficier with SSID pattern and password.

Problem is that it looks like API 29 is doing some kind of caching of the password.
Trying to connect to the network for the first time (after restart) works without problem. Every succeeding request results in API trying to connect using previously entered password (ignoring password passed to it) even if it was entered incorrectly.
This behavior persists until next phone restart.

I’ve reproduced this on Pixel 3XL, Pixel 2 and Samsung Note 10+ so I’m worried if I misused API in some way.
Of course all 3 phones are on Android 10.

How to&Answers: