RequestLocationUpdates参数的android [英] RequestLocationUpdates parameter android
问题描述
我的困惑在这个参数
locationManager.requestLocationUpdates(provider,
60000,
10,
listener);
因此,这里是如何执行位置更新的监听器
。
如果时间= 60000和距离= 10
那么它将执行或
如果时间= 60000或距离= 10
然后它会执行。
请帮我走出这个困惑。
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.
推荐答案
据<一href="http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates%28long,%20float,%20android.location.Criteria,%20android.app.PendingIntent%29"相对=nofollow>的文档:
位置更新之间的运行时间将不会少于 minTime
The elapsed time between location updates will never be less than
minTime
所以 minTime
花费precedence。另外它说:
So minTime
takes precedence. Further on it says :
的minDistance依旧参数也可用于控制的位置更新频率。如果大于0,则该位置提供者将只发送您的应用程序更新时的位置已经被至少minDistance依旧米改变,至少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
所以它应该是如果(时间&gt; = minTime和DIST&GT; = minDistance依旧)
,意义也不会过早的检查距离。但在此之前软糖不采取这些参数过于认真。
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.
这篇关于RequestLocationUpdates参数的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!