4

If

locationClient.setInterval(60*1000);  
locationClient.setSmallesDisplacement(10);       
locationClient.setFastestInterval(1000);   

is given, then when will the updates be called? If user have moved 10mts within 60secs, will location updates be called? Or if user haven't moved any distance within 60secs can the updates be fetched? If all the properties are used at once which will be given priority?

I have used all of them in my app. But, it worked well only when displacement is 1mt and interval is 30secs. And got more weird results when displacement is increased to 20mts keeping interval same.

NinjaCoder
  • 2,381
  • 3
  • 24
  • 46
Revathi
  • 172
  • 8

2 Answers2

2

With 10m displacement and 60 sec interval and no fastestInterval value. Google Play Location Services will try fetch location every 60 sec, see if it was 10m, if yes it will call onLocationChanged otherwise it will discard that value.

Now with fastestInterval = 1, if it will have a location value in 1 sec and if displacement is more than 10m then you will receive location in onLocationChanged

NinjaCoder
  • 2,381
  • 3
  • 24
  • 46
0

I have the same situation like you. I wonder Interval will be call first to be able determine the displacement or the displacement will trigger first.

If User travel 5 meter in your case then travel back to original location 5meter then will locationcleint update newlocation or it wont since user stay at the same location but traveled 10 meter

Jimmy Le
  • 69
  • 1
  • 9