Turning on wifi using WifiManager stops to work on Android 10

public boolean setWifiEnabled (boolean enabled)

This method was deprecated in API level 29.
Starting with Build.VERSION_CODES#Q, applications are not allowed to enable/disable Wi-Fi.

Compatibility Note: 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.

According to documentation, Apps will not be able to turn Wi-Fi OFF/ON anymore from Android-10 API level 29[Until google provides an alternative solution].

For more information see official documentation.

And there is an issue 128554616 has been created in google issuetracker about this.

Leave a Comment