New WiFi APIs on Android 10

Anutosh Datta
Nov 21, 2020
Photo by Jadon Kelly on Unsplash

Prior to Andorid 10, we used WifiManager APIs to connect with and disconnect from a WiFi network. These APIs have been deprecated in API level 29 and if your app’s target SDK is set to 29, these APIs won’t work.

On Android 10 and above, we have to use WifiNetworkSpecifier and ConnectivityManager in order to connect with a network. Below is a code snippet on how to achieve this.

--

--