RequestLocationUpdates parameter android

stuti picture stuti · Jun 10, 2011 · Viewed 8.5k times · Source

I have confusion in this parameter

locationManager.requestLocationUpdates(provider, 
                60000,
                10,
                listener);

So here is how it executes location update listener. if time = 60000 AND distance = 10 then it will execute or if time = 60000 OR distance = 10 then it will execute. Please help me to come out this confusion.

Answer

Mr_and_Mrs_D picture Mr_and_Mrs_D · May 25, 2013

According to the docs :

The elapsed time between location updates will never be less than minTime

So minTime takes precedence. Further on it 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 it should be if(time >= minTime AND dist >= minDistance), meaning won't check distance if too early. BUT don't take those parameters too seriously before JellyBeans.