Skip to content

Colota - Android GPS Location tracker

fix: skip stationary GPS pause inside geofence zones

Max Dietrich387e90255787
diff --git a/apps/docs/docs/development/architecture.md b/apps/docs/docs/development/architecture.md
index 08d91ea7..eb1016a7 100644
--- a/apps/docs/docs/development/architecture.md
+++ b/apps/docs/docs/development/architecture.md
@@ -91,7 +91,7 @@ An Android foreground service that runs continuously for GPS tracking. Manages:
- Anchor points - a synthetic location saved on zone exit as a clean start point for the departing trip
- Battery critical shutdown (below 5% while discharging)
- Location accuracy filtering
-- Stationary detection - pauses GPS after 60s without movement and arms `MotionDetector` to resume on motion (suspended during entry delay)
+- Stationary detection - pauses GPS after 60s without movement and arms `MotionDetector` to resume on motion (suspended during entry delay and inside geofence pause zones)
- Queuing data for server sync
### NotificationHelper
diff --git a/apps/docs/docs/guides/battery-optimization.md b/apps/docs/docs/guides/battery-optimization.md
index 46e02ac9..50a95017 100644
--- a/apps/docs/docs/guides/battery-optimization.md
+++ b/apps/docs/docs/guides/battery-optimization.md
@@ -19,7 +19,7 @@ Settings and tips to reduce battery usage without losing GPS fixes.
1. **Increase GPS interval** - 5s to 30s saves significant battery
2. **Enable accuracy filtering** - Reject poor GPS fixes to avoid unnecessary processing
3. **Use batch sync** instead of instant - Reduces network usage and wake-ups
-4. **Create geofences** for home/work - Stops recording locations in zones, and GPS is also paused after 60s stationary inside a zone
+4. **Create geofences** for home/work - Stops recording locations in known zones. GPS stays active inside the zone to reliably detect when you leave
5. **Enable movement threshold** - 10-50m, skip stationary updates
6. **Disable battery optimization** for Colota in Android settings to prevent the OS from killing the service
diff --git a/apps/docs/docs/guides/geofencing.md b/apps/docs/docs/guides/geofencing.md
index 03c07d5c..780b936c 100644
--- a/apps/docs/docs/guides/geofencing.md
+++ b/apps/docs/docs/guides/geofencing.md
@@ -30,7 +30,7 @@ import ScreenshotGallery from '@site/src/components/ScreenshotGallery'
- The notification shows "Paused: [Zone Name]" once the pause takes effect
- GPS continues running inside the zone to detect when you leave
- If you leave before the entry delay completes, the delay is cancelled and tracking continues uninterrupted
-- If you stay stationary inside a zone, GPS is paused after 60s (if stationary detection is enabled) - the hardware motion sensor then wakes GPS when you start moving. Stationary detection is suspended during the entry delay so arrival points keep being logged even if you stop moving on arrival
+- GPS stays active inside the zone to reliably detect when you leave - stationary detection is suspended inside zones so exit is never missed
- When exiting the zone, tracking automatically resumes
- Zone checks happen every location update with minimal overhead
- You can create unlimited geofence zones
diff --git a/apps/mobile/android/app/src/test/java/com/Colota/service/LocationForegroundServiceTest.kt b/apps/mobile/android/app/src/test/java/com/Colota/service/LocationForegroundServiceTest.kt
index 2a59012c..51d35254 100644
--- a/apps/mobile/android/app/src/test/java/com/Colota/service/LocationForegroundServiceTest.kt
+++ b/apps/mobile/android/app/src/test/java/com/Colota/service/LocationForegroundServiceTest.kt
@@ -1414,7 +1414,7 @@ class LocationForegroundServiceTest {
}
@Test
- fun `evaluateStationaryState starts timer when inside pause zone`() = testScope.runTest {
+ fun `evaluateStationaryState skips timer when inside pause zone`() = testScope.runTest {
setField("config", ServiceConfig(
endpoint = "https://example.com",
pauseWhenStationary = true,
@@ -1430,7 +1430,7 @@ class LocationForegroundServiceTest {
invokeEvaluateStationaryState(location)
val stationaryJob: Job? = getField("stationaryJob")
- assertNotNull("Should start timer inside pause zone - GPS still running there", stationaryJob)
+ assertNull("Should not start stationary timer inside pause zone - GPS must stay running for exit detection", stationaryJob)
}
@Test