-
-
Notifications
You must be signed in to change notification settings - Fork 497
feat: add significat motion sensor support #2146
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
base: master
Are you sure you want to change the base?
Conversation
b9bae0c to
ea18383
Compare
|
Interesting idea. Re: I think there's a case for allowing the user the choice. Could you update this to stick that option behind a preference called something like "waitForAccurateLocation" (to borrow the API name). That should allow the user to choose whether they prefer more, less accurate locations, or fewer more accurate locations. |
Thank you for looking into this and the context! Makes sense. I believe my PR was a little premature and the code still needs more testing. I also tried with the original |
|
More testing is useful, thanks for doing. I may seem overly keen to "put everything behind a preference", but this project's main lesson is that all Android devices across different manufacturers behave very differently to each other. The exact same app with the same configuration can produce a lovely route track on my Pixel, but a horrible mess on someone else's Samsung (glares at Samsung). Tuning this stuff to give a decent result on a specific device is more of an art than anything, so providing the tunables is pretty important imo. |
|
Bad news. After some weeks of testing using car as a means of transport, I concluded that Good news. I've abandoned this approach in favour of trying to wake the device up and request a fresh GPS fix on |
Request GPS position when significant motion is detected using the
Android wake-up TYPE_SIGNIFICANT_MOTION sensor.
The new experimental feature requestLocationOnSignificantMotion is
disabled by default and must be enabled via experimental preferences.
When enabled, the app registers a trigger listener for the
TYPE_SIGNIFICANT_MOTION wake-up sensor. When the sensor detects
significant motion (such as the user starting to walk, moving in a car,
etc.), it triggers a high-accuracy GPS location request. The location
is reported with trigger type "m" (for "motion"). After each trigger,
the listener re-registers itself to wait for the next significant motion
event. This is particularly useful for location tracking during Doze
mode, as the significant motion sensor can wake the device to get a
fresh GPS fix when the user starts moving.
Changes:
* New experimental feature flag requestLocationOnSignificantMotion.
* New report type SIGNIFICANT_MOTION("m"), triggered by significant
motion wake-up sensor. This allows the location trigger to be
identified as coming from significant motion detection.
* SignificantMotionSensor class handling TYPE_SIGNIFICANT_MOTION.
Resolves: 1898#issuecomment-3461721344
019b7d3 to
9178e0c
Compare
|
I've had good success with the latest patch so far. Unfortunately, I couldn't test as much as I wanted (I tested the critical journey by car only 4 times with 100% success). I'll start testing again in January 2026. Publishing the patch for those who also wish to play with this. I believe this can even reduce the Move mode battery usage when bumping |
Request GPS position when significant motion is detected using the Android wake-up
TYPE_SIGNIFICANT_MOTIONsensor.The new experimental feature requestLocationOnSignificantMotion is disabled by default and must be enabled via experimental preferences. When enabled, the app registers a trigger listener for the
TYPE_SIGNIFICANT_MOTIONwake-up sensor. When the sensor detects significant motion (such as the user starting to walk, moving in a car, etc.), it triggers a high-accuracy GPS location request. The location is reported with trigger type "m" (for "motion"). After each trigger, the listener re-registers itself to wait for the next significant motion event. This is particularly useful for location tracking during Doze mode, as the significant motion sensor can wake the device to get a fresh GPS fix when the user starts moving.Changes:
requestLocationOnSignificantMotion.SIGNIFICANT_MOTION("m"), triggered by significantmotion wake-up sensor. This allows the location trigger to be
identified as coming from significant motion detection.
SignificantMotionSensorclass handlingTYPE_SIGNIFICANT_MOTION.Resolves: 1898#issuecomment-3461721344
Important / Full transparency