Skip to content

Colota - Android GPS Location tracker

fix: use accuracy 0 for geofence heartbeat and exit anchor Closes (#299)

Max Dietrichb7dcef79db12
diff --git a/apps/docs/docs/guides/geofencing.md b/apps/docs/docs/guides/geofencing.md
index 6c7083bc..1b7dcc87 100644
--- a/apps/docs/docs/guides/geofencing.md
+++ b/apps/docs/docs/guides/geofencing.md
@@ -67,4 +67,4 @@ When both **WiFi** and **motionless** pause are enabled, GPS only resumes when *
## Anchor Points
-When you exit a pause zone, Colota saves a synthetic location at the geofence center. This gives your new trip a clean start point rather than somewhere mid-road where GPS first locks in. Anchor points use the zone radius as their accuracy value and are timestamped 1 second before the first real GPS fix after leaving the zone, ensuring correct chronological order.
+When you exit a pause zone, Colota saves a synthetic location at the geofence center. This gives your new trip a clean start point rather than somewhere mid-road where GPS first locks in. Anchor points report accuracy 0 so they pass any downstream quality filter and are recognizable as synthetic in backend data, and are timestamped 1 second before the first real GPS fix after leaving the zone, ensuring correct chronological order.
diff --git a/apps/mobile/android/app/src/main/java/com/colota/service/LocationForegroundService.kt b/apps/mobile/android/app/src/main/java/com/colota/service/LocationForegroundService.kt
index e83b7e7c..9db5574d 100644
--- a/apps/mobile/android/app/src/main/java/com/colota/service/LocationForegroundService.kt
+++ b/apps/mobile/android/app/src/main/java/com/colota/service/LocationForegroundService.kt
@@ -874,7 +874,7 @@ class LocationForegroundService : Service() {
val location = Location("geofence").apply {
latitude = zone.lat
longitude = zone.lon
- accuracy = zone.radius.toFloat()
+ accuracy = 0f
time = System.currentTimeMillis()
}
lastKnownLocation = location
@@ -960,7 +960,7 @@ class LocationForegroundService : Service() {
val syntheticLocation = Location("geofence").apply {
latitude = geofence.lat
longitude = geofence.lon
- accuracy = geofence.radius.toFloat()
+ accuracy = 0f
time = anchorTimeMs
}
@@ -968,7 +968,7 @@ class LocationForegroundService : Service() {
val locationId = dbHelper.saveLocation(
latitude = geofence.lat,
longitude = geofence.lon,
- accuracy = geofence.radius,
+ accuracy = 0.0,
altitude = null,
speed = null,
bearing = null,
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 e2670ecb..829abd81 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
@@ -762,7 +762,7 @@ class LocationForegroundServiceTest {
verify { dbHelper.saveLocation(
latitude = homeGeofence.lat,
longitude = homeGeofence.lon,
- accuracy = homeGeofence.radius,
+ accuracy = 0.0,
altitude = null,
speed = null,
bearing = null,
@@ -789,7 +789,7 @@ class LocationForegroundServiceTest {
verify { dbHelper.saveLocation(
latitude = homeGeofence.lat,
longitude = homeGeofence.lon,
- accuracy = homeGeofence.radius,
+ accuracy = 0.0,
altitude = null,
speed = null,
bearing = null,