by Mattia Brunelli
Version 3 (March 31, 2026)
Download (9 downloads)
Change OwnTracks location reporting mode based on phone activity
Forked from “OwntracksControl” by Alexander Terczka, this version adjusts the reporting mode dynamically based on physical activity rather than WiFi connection.
The original approach, tied to an active WiFi connection, proved unreliable, especially when my phone entered doze mode overnight. It also didn’t account well for real-world scenarios where the device disconnect but the user is stationary (e.g. at the gym, in a restaurant, or sitting down at the park).
This flow solves the issue by leveraging physical activity sensors to detect whether the user is walking, running, in a vehicle, or still, etc... This allows the reporting behavior to adapt to actual movement, rather than relying on predefined conditions or network state.
By default, the device is set to Quiet mode when the detected activity is STILL (the device is not moving) for at least 10 seconds with a confidence > 80%.
You can customize this behavior by mapping detected activities to different reporting modes. For example:
If detected_activity = STILL (8) → set mode to Manual or Significant Changes
If activity is anything else → switch to a more dynamic mode like Move
Available modes and corresponding values:
Quiet → -1
Manual → 0
Significant Changes → 1
Move → 2
Alternatively, you can implement a fully custom logic that dynamically adapts the reporting mode based on the specific detected activity, giving you fine-grained control over how and when location updates are sent.
If you're looking for a serverless solution for ingesting and storing OwnTracks location data, check out this repository: https://github.com/brodo97/locations-tracker