Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LocationEngine doesn't respect fastest interval setting #312

Open
LukasPaczos opened this issue Dec 7, 2018 · 7 comments
Open

LocationEngine doesn't respect fastest interval setting #312

LukasPaczos opened this issue Dec 7, 2018 · 7 comments

Comments

@LukasPaczos
Copy link
Contributor

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.

@Chaoba
Copy link
Contributor

Chaoba commented Feb 28, 2019

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.

@andrlee
Copy link
Contributor

andrlee commented Mar 1, 2019

@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 ?

@LukasPaczos
Copy link
Contributor Author

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

@alfwatt
Copy link
Contributor

alfwatt commented Jun 17, 2019

Open Branch with PR - needs review and merge

@alfwatt
Copy link
Contributor

alfwatt commented Oct 22, 2019

@Cloud9Clone
Copy link

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

@nkukday
Copy link
Contributor

nkukday commented May 4, 2020

@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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants