Since setWifiEnabled is deprecated on Android 10, how does one programatically enable wifi on Android 10 devices?
Is it not possible to programatically enable wifi at all on Android 10+ (SDK 29) ?
No, This is not possible to enable
or disable
Wi-Fi programmatically
from Android-10
API level 29
[Until google provides an alternative solution].
For applications targeting Build.VERSION_CODES.Q or above, this API will always return false and will have no effect.
If apps are targeting an older SDK ( Build.VERSION_CODES.P or below), they can continue to use this API.
There is an issue 128554616 which already has been created in google issuetracker
forum. You can see there for any updated info.
来源:https://stackoverflow.com/questions/58075918/is-it-possible-to-programatically-enable-wifi-on-android-10-devices