Skip to content
This repository was archived by the owner on Mar 16, 2026. It is now read-only.
This repository was archived by the owner on Mar 16, 2026. It is now read-only.

LocationEngine doesn't respect fastest interval setting #312

Open

Description

@LukasPaczos

I'm seeing, that even after setting the setFastestInterval option the location updates can be pushed with higher than expected frequency.

Here's a log dump of differences in time between location samples with the fastest interval set to 750ms.

D/TEST: 1020
D/TEST: 15
D/TEST: 992
D/TEST: 1010
D/TEST: 1001
D/TEST: 972
D/TEST: 1016
D/TEST: 988
D/TEST: 12
D/TEST: 1012
D/TEST: 996
D/TEST: 1007
D/TEST: 1001
D/TEST: 1000
D/TEST: 983
D/TEST: 17
D/TEST: 1001
D/TEST: 998
D/TEST: 1005
D/TEST: 994
D/TEST: 989
D/TEST: 15
D/TEST: 1004
D/TEST: 991
D/TEST: 1009
D/TEST: 999

and here's the setup:

LocationEngine locationEngine = LocationEngineProvider.getBestLocationEngine(this);
locationEngine.requestLocationUpdates(
  new LocationEngineRequest.Builder(750)
    .setFastestInterval(750)
    .setPriority(LocationEngineRequest.PRIORITY_HIGH_ACCURACY)
    .build(),
  new LocationEngineCallback<LocationEngineResult>() {

    private long last = 0;

    @Override
    public void onSuccess(LocationEngineResult result) {
      long current = System.currentTimeMillis();
      long diff = current - last;
      last = current;
      Logger.d("TEST", String.valueOf(diff));
    }

    @Override
    public void onFailure(@NonNull Exception exception) {
    }
  },
  Looper.getMainLooper());

This particualr example was using MapboxFusedLocationEngineImpl and libtelemetry v4.1.1.

Activity

  1. self-assigned this
    on Jan 11, 2019
  2. assigned and unassigned on Feb 26, 2019
  3. Chaoba commented on Feb 28, 2019

    @Chaoba
    Contributor

    By doing some tests, my preliminary conclusion is that

    1. If we use GoogleLocationEngineImpl, the fastest interval will works.
    2. If we use MapboxFusedLocationEngineImpl, setFastestInterval will not works since it will pass the Interval parameter to location API and in framework it will set fastest interval with the same value of interval.
      3.In this case we set interval to 750ms and still could get location update in last than 750ms, since we pass the value correctly to System API, so I guess it is some thing wrong with framework, not our location sdk.
  4. andrlee commented on Mar 1, 2019

    @andrlee

    @Chaoba since Android framework doesn't support fastestInterval, the gist of the ask is to implement downsampling of the location events internally in MapboxFusedLocationEngineImpl when both interval and fastestInterval are provided by the user. Did i miss anything @LukasPaczos ?

  5. LukasPaczos commented on Mar 1, 2019

    @LukasPaczos
    ContributorAuthor

    No, I don't think so - if we're exposing this setter, it should be respected regardless of the implementation.

  6. alfwatt commented on Jun 17, 2019

    @alfwatt

    Open Branch with PR - needs review and merge

  7. Cloud9Clone commented on May 2, 2020

    @Cloud9Clone

    Do we require a billing account in order to use the Google's FusedLocationProvider?

  8. nkukday commented on May 4, 2020

    @nkukday

    @Cloud9Clone FusedLocationProvider is integrated in Google Play Services and can be used with the play service dependency so long as play services are available on the device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions