biotinker / LibreTasks

An updated form of Omnidroid
Apache License 2.0
82 stars 22 forks source link

GPS is being queried permanently, whether or not it is needed #216

Closed mvglasow closed 5 years ago

mvglasow commented 7 years ago

When LibreTasks is running, it constantly queries GPS, regardless of whether it’s needed for any active rule. I fear this is going to drain the battery pretty quickly.

I suggest requesting GPS location updates only when a location-based rule is active.

mvglasow commented 7 years ago

After a few weeks of digging through the code, I guess this might be difficult to implement, as location is a default attribute, available with any event, and which can occur in a variety of places:

The first two are probably easy to catch, but getting a list of all rules which use location attributes in their actions might not be doable in a manner that is guaranteed to be work even with future actions.

As a workaround, we might do the following:

Any opinions on that?

mvglasow commented 7 years ago

Just another thought that came to my mind: make the location source configurable via two options in Preferences:

If the first option is selected, subscribe (only) to the passive location provider. When a location is received, process it only if it matches the provider selected in the second option (“any” will match any provider).

If the first option is not selected, use the second option to decide which location provider to subscribe to (for “any”, subscribe to all location providers available).

On top of that, we can still implement “request location updates” as an action, potentially with the following parameters:

mvglasow commented 6 years ago

Basic functionality (select passive location provider or a specific one) is available in #227 . Changes currently require a restart of LibreTasks (or some way of re-registering with the location provider). The optional parts are not part of the pull request. Default behavior is to use GPS, as before.

emil-petersen commented 6 years ago

@mvglasow Hey, I am interested in using LibreTasks since I am running on an android version with no google services (copperhead). Thank you for addressing this issue. I will experiment with the location trigger, and depending on how it works out I may be looking to contribute some actions / triggers or other help with the project.

biotinker commented 5 years ago

Closing as this is fixed in newest release