Skip to content
This repository was archived by the owner on Apr 23, 2023. It is now read-only.
This repository was archived by the owner on Apr 23, 2023. It is now read-only.

Throttled location updates when in foreground service? #255

@Phyks

Description

@Phyks

Hi,

Description

I am using Traccar client for Android for tracking my phone position. It basically wraps around LOST, as can be seen here. I tried to debug a bit around the issue and so far it seems to be coming from within LOST.

The app uses a foreground service to update location, main location updating code is mainly here.

For my tests, the setInterval call (https://github.com/tananaev/traccar-client-android/blob/master/app/src/main/java/org/traccar/client/PositionProvider.java#L91-L94) is such that the location should be updated every minute. That's more or less the case when the app is running in foreground (between 60 and 120s, but that's more or less accurate).

However, whenever the app is running in background, the location is no longer updated at the expected interval. It seems that LOST is not sending events at expected interval. Basically, with a 1 minute interval, the location is updated every 4 minutes in background. And with 10 mins interval, that's even worse and the location is updated once per hour.

I am using NetworkProvider (running LineageOS 14.1 with microg, and using the UnifiedNIP location provider). Everything is working perfectly fine when the app is in background.

Is there any reason for this difference of intervals? Is Android throttling location updates in the background? So far, the only reason I could come up with (from the docs) is the "battery optimization" feature of latest Android versions, but I tried to disable with with same results.

Lost & Android Version

LineageOS 14.1 with microg + LOST 3.0.4 (in https://github.com/tananaev/traccar-client-android).

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions