Traccar sometimes keeps the GPS continuously active indefinitely, even when an Android device is completely stationary for several hours (for example, sitting untouched on a desk). Worth mentioning it doesn't affect all devices and isn't always happening all the time on the same device.
Configuration
The affected devices are all Android devices. I don't have any iPhones available at hand to test whether the issue also occurs on iOS anyways.
Traccar settings are:
Accuracy: Highest
Stop detection: Enabled
Use system location: Disabled
Observed behavior
When the device remains completely stationary for hours, Traccar sometimes continues keeping the GPS active continuously instead of transitioning to stationary mode.
I initially wasn't sure what was causing this because the logs don't record the recognized activity or its probability alongside each location update.
To investigate, I exported the logs while the device was completely stationary and the GPS remained continuously active for several hours and the distance between any 2 consecutive coordinates remained less than 2 minutes at any given moment which shouldn't trigger switching to moving state.
all distances in logs are in meters btw
Here are the logs while experiencing the bug
I then disabled continuous tracking for a moment and enabled it again. Since Traccar fetches and logs the device's current recognized activity when continuous tracking is first enabled, I was able to see that the device was recognized as still with 100% probability.
all distances in logs are in meters btw
Here are the logs after switching continuous tracking off then back on again
Interestingly, a couple of minutes after re-enabling continuous tracking, the GPS was turned off and Traccar correctly entered stationary mode.
This raises the question: if Traccar already recognized the device as stationary with 100% probability, why did it previously continue keeping the GPS active for hours as though the device were moving?
This makes me suspect that there may be a problem with how the recognized activity/state is being used to transition between moving and stationary modes, or that the activity recognition result isn't being evaluated/received correctly while continuous tracking is already running. or maybe sometimes traccar isn't getting the recognized activity from android?.
However, without the activity recognition result and Traccar's internal moving/stationary state being logged for each location update, it is difficult to determine exactly where the problem occurs.
Feature request / debugging information
Would it be possible to include the following information in the logs for every location update?
Traccar's current device state (moving or stationary)
The recognized activity (e.g. still, walking, in vehicle, etc.)
The probability/confidence of the recognized activity
Ideally, any relevant information indicating why continuous GPS/location tracking was kept active or why it transitioned to/from stationary/moving mode
This would be particularly useful now that Traccar supports exporting logs as files, because it would make it possible to capture and analyze the exact sequence of events leading to this issue.
Having these values logged alongside each location update would hopefully make it much easier to determine whether the problem is with Android's activity recognition, Traccar's interpretation of the activity result, or the logic responsible for switching between moving and stationary tracking.
Traccar sometimes keeps the GPS continuously active indefinitely, even when an Android device is completely stationary for several hours (for example, sitting untouched on a desk). Worth mentioning it doesn't affect all devices and isn't always happening all the time on the same device.
Configuration
The affected devices are all Android devices. I don't have any iPhones available at hand to test whether the issue also occurs on iOS anyways.
Traccar settings are:
Accuracy: Highest
Stop detection: Enabled
Use system location: Disabled
Observed behavior
When the device remains completely stationary for hours, Traccar sometimes continues keeping the GPS active continuously instead of transitioning to stationary mode.
I initially wasn't sure what was causing this because the logs don't record the recognized activity or its probability alongside each location update.
To investigate, I exported the logs while the device was completely stationary and the GPS remained continuously active for several hours and the distance between any 2 consecutive coordinates remained less than 2 minutes at any given moment which shouldn't trigger switching to moving state.
all distances in logs are in meters btw
Here are the logs while experiencing the bug
I then disabled continuous tracking for a moment and enabled it again. Since Traccar fetches and logs the device's current recognized activity when continuous tracking is first enabled, I was able to see that the device was recognized as still with 100% probability.
all distances in logs are in meters btw
Here are the logs after switching continuous tracking off then back on again
Interestingly, a couple of minutes after re-enabling continuous tracking, the GPS was turned off and Traccar correctly entered stationary mode.
This raises the question: if Traccar already recognized the device as stationary with 100% probability, why did it previously continue keeping the GPS active for hours as though the device were moving?
This makes me suspect that there may be a problem with how the recognized activity/state is being used to transition between moving and stationary modes, or that the activity recognition result isn't being evaluated/received correctly while continuous tracking is already running. or maybe sometimes traccar isn't getting the recognized activity from android?.
However, without the activity recognition result and Traccar's internal moving/stationary state being logged for each location update, it is difficult to determine exactly where the problem occurs.
Feature request / debugging information
Would it be possible to include the following information in the logs for every location update?
Traccar's current device state (moving or stationary)
The recognized activity (e.g. still, walking, in vehicle, etc.)
The probability/confidence of the recognized activity
Ideally, any relevant information indicating why continuous GPS/location tracking was kept active or why it transitioned to/from stationary/moving mode
This would be particularly useful now that Traccar supports exporting logs as files, because it would make it possible to capture and analyze the exact sequence of events leading to this issue.
Having these values logged alongside each location update would hopefully make it much easier to determine whether the problem is with Android's activity recognition, Traccar's interpretation of the activity result, or the logic responsible for switching between moving and stationary tracking.