feat: log speed source (native or calculated) for better debugging

This commit is contained in:
fiatcode 2026-05-02 17:39:51 +07:00
parent 1319167165
commit ef187fbc73
No known key found for this signature in database

View file

@ -256,7 +256,7 @@ class LocationTrackingService : Service() {
isMoving = (nativeSpeed ?: 0f) > 1.0f
)
logEvent("LOCATION", "Lat: ${location.latitude}, Lon: ${location.longitude}, Speed: ${location.speed}")
logEvent("LOCATION", "Lat: ${location.latitude}, Lon: ${location.longitude}, Speed: ${location.speed} (native)")
updateNotification(location)
@ -326,7 +326,8 @@ class LocationTrackingService : Service() {
logEvent("SPEED_CALC", "Speed calculation failed - sending without speed")
// Fallback: send location without speed rather than losing it
} else {
logEvent("LOCATION", "Lat: ${location.latitude}, Lon: ${location.longitude}, Calc Speed: ${finalSpeed}")
val speedSource = if (location.hasSpeed() && location.speed > 0) "native" else "calculated"
logEvent("LOCATION", "Lat: ${location.latitude}, Lon: ${location.longitude}, Speed: ${finalSpeed} ($speedSource)")
}
val speedToSend = if (finalSpeed != null && finalSpeed > 0) finalSpeed else null