gpt4 book ai didi

java - getLastKnownLocation 与请求位置更新

转载 作者:行者123 更新时间:2023-11-30 11:20:46 30 4
gpt4 key购买 nike

我想每 5 分钟从我的 Android 应用向服务器发送一次最新和最准确的位置。

在此question我被建议创建一个将注册到 LocationUpdates 的 alarmManager。

为什么这比调用 getLastKnownLocation 更好

并检查其准确性?

最佳答案

getLastKnownLocation 将为您提供网络提供商的最后定位。它可能无法提供确切的当前位置(请参阅谷歌文档)另一方面,LocationUpdates 将提供当前位置。您可以使用 locationClient 实现它。当位置更改时,将调用 OnLocationChanged(Location l) 方法,这将为您提供最近的位置。您还可以设置更新位置的时间。

关于java - getLastKnownLocation 与请求位置更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22575433/

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