'WifiManager getConnectionInfo() got deprecated in Android API level 31

We uses Wifimanger getConnectionInfo() method to get SSID and BBSID of connected wifi. But starting with Andorid API level 31 , Android has deprecated the getConnectionInfo() method.

The solution that they have provided to use getTransportInfo() required minimum Android level 29 which we cannot target , given our 20 percent user still on Android API level below 29.

Can someone help with the alternative method to get connected wifi.

https://developer.android.com/reference/android/net/wifi/WifiManager#getConnectionInfo()



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source