Tobi823 / ffupdater

FFUpdater: Updater for privacy friendly browser

Home Page:https://f-droid.org/en/packages/de.marmaro.krt.ffupdater

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do not download updates when battery saver is enabled

kaikli opened this issue · comments

Is your feature request related to a problem? Please describe.
I have noticed that ffupdater dosen't respect the battery saver setting. Even if activated the app downloads updates automatically in the background.

Describe the solution you'd like
Add a option to disable automatic sync/download in the background when power saving mode is activated.

My bad - I though that I implemented that but I only check if battery is low or the data saver is activated.

I would prefer a solution without adding a new setting option.

What do you think to this proposal?

If the battery saver is enabled for less than 24h, then don't check for updates.
If it is enabled for longer than 24h, then only check for updates and don't download APK files in the background.

Why? I think that there are two scenarios:
A: User is low on battery and can't charge the phone => temporary disable update checks
B: User always enable battery saver => FFUpdater should still be able to check for updates in the background

This would be fine.
Maybe reduce the update interval when the battery saver is enabled? Especially for people who set this setting lower than 4 hours.

How do you plan to detect how long the battery saver is enabled? Is there a timestamp you can read from Android or would you save the status of the last update check? Or maybe set a timer for 24h when the battery saver is enabled and reset this timer when the battery saver is deactivated again.

I think that I can register a listener/callback when the "power save mode" is changed. https://developer.android.com/reference/android/os/PowerManager#ACTION_POWER_SAVE_MODE_CHANGED

And when it is changed, I can store the time.

But I still have to test it :)

It is now implemented 65e6e79

I will implement the next days.