j4velin / WiFi-Automatic

Automatically turn off WiFi if you don't need it
https://play.google.com/store/apps/details?id=de.j4velin.wifiAutoOff
Apache License 2.0
70 stars 32 forks source link

Disabling Wifi no longer working with target SDK 29 #54

Closed sanderbos closed 3 years ago

sanderbos commented 3 years ago

Wifi Automatic is no longer working for me, since a few weeks Wifi is not disabled anymore after one hour of being outside of Wifi range (this is the setting I use). This is on a OnePlus 6 phone running Android 10 (there have been no recent updates on the phone).

Since WiFi automatic is open source I compiled it myself (with some difficulty, because I am not an Android developer).

It is caused by uses-sdk android:targetSdkVersion="29" in the manifest file, if I change it back to 28 it works again for me. (there were so few changes that this was the only real candidate)

https://developer.android.com/reference/android/net/wifi/WifiManager#setWifiEnabled(boolean) seems to suggest that indeed something was changed with API level 29 in that method. Is it still working for you (can Wifi be disabled by the app on your phone?)?

I attached some captured matlog: 2021-04-22-18-28-18.txt I guess the only relevant lines are: 04-22 18:27:33.369 I/WifiService(1302): setWifiEnabled not allowed for uid=10462 04-22 18:27:33.383 D/WiFi-Automatic(15741): Unable to change WiFi state

sanderbos commented 3 years ago

(Side note: Could you change to classpath 'com.android.tools.build:gradle:3.5.4' or something like that in your build .gradle, as a non-Android developer I had so much trouble getting it to compile...)

j4velin commented 3 years ago

Yes, unfortunately that is true (Google issue tracker: https://issuetracker.google.com/issues/128554616). The app will no longer work when the target SDK is set to 29 or above - however, to be able to update the app in the Google Play Store, it requires at least target SDK 29 at the moment... So I guess I'll keep the "old" version on Google Play for now and you'd need to use F-Droid for any further updates (if there are any)

sanderbos commented 3 years ago

I updated the app from Google Play and indeed it's working again. Thanks. Sorry to hear that Google decided to break your app...