+-
RequestLocationUpdates参数android
我对这个参数感到困惑

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

所以这是它如何执行位置更新侦听器.
如果时间= 60000并且距离= 10那么它将执行或
如果时间= 60000或距离= 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.

点击查看更多相关文章

转载注明原文:RequestLocationUpdates参数android - 乐贴网