android - RequestLocationUpdates参数android

标签 android locationmanager

我对这个参数感到困惑

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/

相关文章:

javascript - Android 4.4 上的 WebView - 使用 JavaScript 更改字体

android:可以在 30 秒内使用 LocationManager 和 Samsung Galaxy S2 获取位置

android - getLastKnownLocation 方法始终返回 null

android - 如何在 Fragment 中获取对 LocationManager 的引用

android - 获取最后一个位置,有很多方法

android - 每次请求位置更新时都应该使用 android LocationManager.getBestProvider 吗?

android - Canvas : clear rect but keep the rest of the content

android - getSupportFragmentManager() 与 android 3.0+ 中的 getFragmentManager()

java - Android BLE onCharacteristicChanged 未触发

android - Android AudioTrack类,用于播放钢琴声音