Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use saveTrackMinDistance as distanceFilter at location manager level #3179

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hschaeidt
Copy link

@hschaeidt hschaeidt commented Oct 19, 2023

I was looking for a way to improve battery usage when trip recording while the app is in background.

This PR is a draft and builds on the following assumptions, please correct me if they are wrong.

In my understanding whenever the distanceFilter value is reached, iOS will "wake" the app in the background. Currently when having a speed <10 this value defaults to 5 (meters?), which seems like a very high precision to me, especially when having bad GPS conditions. In my scenario it results in a 100% background activity every time (up to 1h background activity/hour), even when not moving the device at all.

In my trip recording settings I've set the value for "Minimum displacement" to 50 meters/units. So there is no reason to call the update function every 5 meters/units, when no active navigation/following is running.

I was not able to test if this change has the expected impact, as I don't have a valid provisioning profile to install the app on my physical device. I however tested the changes in the simulator, to see if the values were set correctly.

What do you think, could this change possibly reduce power consumption when running in background or did I miss the point?

- The default slow speed value is `5` (`OAApplicationMode`)
- Hopefully improves app usage in background
@hschaeidt hschaeidt marked this pull request as draft October 19, 2023 15:18
@hschaeidt hschaeidt changed the title Use saveTrackMinDistance at location service level Use saveTrackMinDistance as distanceFilter at location manager level Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant