Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

requestLocationUpdates parameters

Tags:

java

android

Thats how the requestLocationUpdates looks like(the way I use it):

requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener)

My question is if the logical connection between the minTime and the minDistance is OR or AND. If the minTime has passed will it wait for the minDistance or not?

OR or AND

like image 534
Imri Persiado Avatar asked Dec 16 '22 15:12

Imri Persiado


2 Answers

The documentation on requestLocationUpdate() says:

The minDistance parameter can also be used to control the frequency of location updates. If it is greater than 0 then the location provider will only send your application an update when the location has changed by at least minDistance meters, AND at least minTime milliseconds have passed

So both parameters must be satisfied before you'll receive an update if you specify non-0 values.

like image 193
jprofitt Avatar answered Dec 30 '22 22:12

jprofitt


If you set minTime to 0, it will be called once when it first receives a location update, then it won't be called until you change your position in minDistance meters.

like image 28
Serdar Samancıoğlu Avatar answered Dec 30 '22 22:12

Serdar Samancıoğlu