android - 在 locationRequest.setFastestInterval 之前收到位置

标签 android location location-client

我已将间隔和最快间隔设置为,

locationRequest.setInterval(30 * 60 * 1000); //30 minutes
locationRequest.setFastestInterval(30 *60 * 1000); //30 minutes

但我有时会在 30 分钟前收到位置更新,而且时间间隔不均匀。例如,有时会在 3 分钟、4 分钟、10 分钟后收到位置更新。

我的待定意向设置为,

mPendingIntent = PendingIntent.getService(context, 0, mIntentService, PendingIntent.FLAG_UPDATE_CURRENT);

这是预期的行为还是我需要以其他方式处理它?<​​/p>

最佳答案

降低 setFastestInterval 速率很可能会导致更稳定的位置更新。

另请观看此视频了解更多信息: https://youtu.be/81W61JA6YHw

关于android - 在 locationRequest.setFastestInterval 之前收到位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27399120/

相关文章:

javascript - 如何在单击按钮或单选按钮时显示组件

android - 在我的项目中添加阴影生成的 jar 时出现重复条目​​异常

linux 脚本,标准目录位置

android - 在许多 Android Activity 中使用当前位置

java - Android Studio 中的分数计数器错误

android - 将图像从一个 Activity 传递到另一个 Activity

java - 调用虚方法 double android.location.Location.getLatitude

java - 如何在 Android Studio 中请求位置权限?

android - LocationClient.getLastLocation() 尽管已连接但返回 Null