android - 当您使用距离过滤器时,gps 如何知道它移动了 x 米?

标签 android

gps 有什么方法可以智能地做到这一点,还是它只是以给定的频率检查位置,如果位置小于 x 米,它就不会触发事件?

最佳答案

参见 requestLocationUpdates()文档:

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. However it is more difficult for location providers to save power using the minDistance parameter, so minTime should be the primary tool to conserving battery life.

因此,通过声明 minDistance,您也声明了 minTime。如果 minTime 到期并且您的设备移动了至少 minDistance,提供商将向您发送更新。所以你的假设是正确的。另请注意,minTime 只是提供者的提示,您可能会在 minTime 再次过期之前获得更新。

关于android - 当您使用距离过滤器时,gps 如何知道它移动了 x 米?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11484497/

相关文章:

android - 是否可以在同一屏幕上显示 Camera Preview 和 TextView?

android 如何同时拥有edittext自动格式本身和可计算的值

android - 如何在 Android 上自定义 Qt 消息处理程序

javascript - jQuery show()/hide() 在 iPhone/Android 上工作吗?

android - 单击通知恢复 Activity

android - 如何在VideoView中播放视频?

java - 从显示图像的 Activity 来回移动时,会出现内存错误。不释放图像?

android - 如何更改 android 选项卡主机中选定选项卡的颜色?

android - 我无法在 Android 上运行 firebase 崩溃报告

java - 使用 BufferedReader 时在 String 的开头添加 Null