Use saveTrackMinDistance
as distanceFilter
at location manager level
#3179
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?