Cilenco / skipTrackLongPressVolume

MIT License
130 stars 14 forks source link

Idea: disable battery optimization to run without a foreground service #3

Open grishka opened 5 years ago

grishka commented 5 years ago

There is a documented way to bypass "battery optimization" as they call it by asking the user to whitelist the app. Supposedly, this allows apps to run regular, non-foreground services indefinitely. I haven't tested this myself, but Google's own Android Wear app uses this to run the service that communicates with the watch.

Cilenco commented 5 years ago

Thank you for that idea. I'm working on it

Supposedly, this allows apps to run regular, non-foreground services indefinitely.

Do you have any more information about that? The linked documentation only points out WakeLocks... Anybody ones to work on this please see the background_optimization branch.

indianpoptart commented 5 years ago

This may be helpful? https://github.com/alexstyl/Memento-Calendar/issues/151#issuecomment-326736192

Otherwise you can check on the dev branch where I have put a power exclude setting(However it's kotlin)

Cilenco commented 5 years ago

Thank you @indianpoptart. I will have a look on that!

Yeah I saw your code. Actually I edited that in the background_optimization branch by removing the NotificationListenerService but since then the execution in the background does not work any longer.

If you wanna test it yourself make sure the Activity is removed from the recent apps.

indianpoptart commented 5 years ago

I'll definitely test the background branch and see if it changes anything, or if I can find a solution.

Cheers!

Cilenco commented 5 years ago

Maybe the DeviceAdminService is a better alternative but I'm not 100% sure about that...