capacitor-community/background-geolocation

distanceFilter battery consumption

loicrob opened this issue · 1 comments

Hi,

This is more a question than an Issue report, but I didn't know where to ask it, sorry if it is inappropriate.

For a Ionic app project, my teammate and I want to detect and record rides. To do so, for the moment, we use the Background Geolocation watcher of this plugin as follows:

  • a watcher constantly enabled with a distance filter to detect the beginning of a new ride;
  • a watcher (with no distance filter) enabled when the first one detects that a distance has been traveled to record the ride.

We noticed that the first watcher consumes battery, especially during the night (~30% consumed) and we were wondering if it would be a better way to constantly watch the accelerometer to detect new rides, in order to save battery.

Here are the questions:

  • does the distance filter system already estimates the distance traveled using the accelerometer and/or gyroscope? (So it would be useless to implement our idea);
  • do you think that our current system is a good practice? Else would you think about a better way to do it?

Thanks for helping,
Best regards

I actually don't know whether the OS uses accelerometer data. Here are the relevant sections for Android and iOS if you want to dig deeper.

You might want to look into geofencing, that will be far more battery efficient than constantly monitoring GPS.