GPS stuck constantly on when stationary on some devices. Logs provided

Antony yesterday

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.

Anton Tananaev 21 hours ago

Could you provide logs covering tracking startup, some movement, and then leaving the device stationary until the problem appears? Please export shortly afterward, since only the latest 5,000 entries are retained and earlier events get overwritten.

Antony 21 hours ago

Problem is, issue is inconsistent. The same device might not always experience the issue. That's why when by the time it happens, most probably the last start tracking log event would have been overridden. That is why I was wondering if you could include the necessary info with each log entry to be able to figure out where is the issue coming from.

Anton Tananaev 21 hours ago

Alternative solution is to reduce reporting frequency.

Antony 20 hours ago

Not sure what you mean honestly. Do you mean reducing the interval value?

Anton Tananaev 20 hours ago

Basically yes, but I don't know your configuration.

Antony 20 hours ago

Hmmm. How is this going to help if you don't mind me asking? Currently it is set to 30 seconds. If reduced that means for example the app will send a location update at an interval of 5 seconds instead of 30 when in moving state.

Anton Tananaev 20 hours ago

It's going to help and get full logs, including relevant data.

Antony 20 hours ago

Or if you mean by reduce reporting frequency, to increase the interval. That will mean to send a location ipdate once every 120 seconds instead. But the vast majority of entries in logs is obtaining gps coordinates not sending an update so don't think this will help honestly

Antony 20 hours ago

Ok, sure will try it on all of my test devices and wait untill a device faces issue and share logs