gpt4 book ai didi

android - RequestLocationUpdates参数android

转载 作者:太空宇宙 更新时间:2023-11-03 13:04:49 24 4
gpt4 key购买 nike

我对这个参数感到困惑

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

下面是它如何执行location update listenerif 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com