我对这个参数感到困惑
locationManager.requestLocationUpdates(provider,
60000,
10,
listener);
下面是它如何执行location update listener
。
if time = 60000 AND distance = 10
那么它将执行或
if time = 60000 OR distance = 10
然后它会执行。
请帮我解决这个困惑。
最佳答案
根据 the docs :
The elapsed time between location updates will never be less than
minTime
因此 minTime
优先。进一步说:
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
所以它应该是 if(time >= minTime AND dist >= minDistance)
,意思是如果太早就不会检查距离。但是不要太认真地对待这些参数before JellyBeans .
关于android - RequestLocationUpdates参数android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6302175/