0

I am facing with one problem. I am using Fused Location Provider and in docs it writes that when we use high priority, we will get updates on every 5 seconds, but I have watched some tutorial and that guy wrote this function

protected void createLocationRequest(){
    mLocationRequest=new LocationRequest();
    mLocationRequest.setInterval(INTERVAL);
    mLocationRequest.setFastestInterval(FASTEST_INTERVAL);
    mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
}

This INTERVAL is 10 seconds. Is that mean that I will get updates on every 10 seconds or on 5 seconds(like it writes in docs for using high priority)? Thanks in advance.

1 Answers1

2

Interval 10 seconds : You will receive location updates approximately at each 10 seconds. But it's approximate, it may give location less or more than 10 seconds.

fastest interval : This value must be lower than interval value. Okay we know that location updates will come us around 10 seconds(more or less). fastest means here, i dont wanna receive location updates lower than this value(fastest interval)

Assume that you have below parameters

  • Interval : 10 seconds
  • Fastest Interval : 5 seconds

And possible result could be like below (assumption)

01:00:00 (Requested)

01:00:12 (location update, 12 seconds)

01:00:22 (location update, 10 seconds)

01:00:30 (location update, 8 seconds)

01:00:38 (location update, 8 seconds)

01:00:46 (location update, 8 seconds)

01:00:52 (location update, 6 seconds)

01:00:59 (location update, 7 seconds)

...

Result : You received location updates about 10 seconds and more than 5 seconds

blackkara
  • 4,900
  • 4
  • 28
  • 58
  • Thanks bro, just one more question please...Does anywhere writes how many seconds do we need for obtaining location for the first time(e.g when app is first time lauched)? Does that depends from interval and FastestInterval or not? –  Jun 30 '16 at 07:31
  • Generally it will tend to these parameters (around interval and greater than fastest value). But in some cases it could change. For example, if you staying in a building or closed area, this time may take long. – blackkara Jun 30 '16 at 09:41
  • And what about cashing in Fused Provider? With this my code location update is on every 10 seconds, but where are cashed locations? –  Jun 30 '16 at 10:02
  • What you meant by saying cashing ? It could be caching ? – blackkara Jun 30 '16 at 10:11
  • Yeah, I mean when I read some articles about gps, network provider(before I have found Fused provider) I read that when android location is launched then first information that we have is cashed gps or cashed network provider and after some time we finally get current position....Is this process the same in Fused provider? –  Jun 30 '16 at 10:14
  • Yes, same thing. If it has previously received location, then you can get it. – blackkara Jun 30 '16 at 10:27
  • Thanks mate. You really help me with these locations...If you have time check out my new question about this topic...http://stackoverflow.com/questions/38117210/fused-location-provider-on-server-demand..I am so gratefull to you :) –  Jun 30 '16 at 10:30