获取 GPS 定位的合理超时时间是多少?
我正在创建一个请求用户位置的 BREW 应用程序。
如果手机无法获取位置,我想显示错误。
在我确定手机不太可能获得 GPS 定位之前,我应该等待多久才能拨打回拨电话?
I am creating a BREW app that requests the user's position.
If the phone cannot acquire the position, I would like to display an error.
How long should I wait for my callback to be called before I determine that the phone is not likely to get a GPS fix?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我可能会在通知用户您无法建立链接之间增加一个增量(例如 20 或 30 秒),并为他们提供停止尝试的选项。坚持下去,直到他们阻止你,或者一定数量的迭代已经通过(比如 5 - 10 次迭代)。
I might go with an increment (say 20 or 30 seconds) between notifying the user that you have failed to establish a link, and give them the option to stop trying. Keep at it until they stop you, or a set number of iterations have passes (say 5 - 10 iterations).
45-90 秒。
有关详细信息,请参阅 Wikipedia 上的 GPS 首次定位时间文章。
但你永远无法知道用户何时真正能够看到卫星,也许当他们启动你的程序时他们仍在室内,因此 Matthew Vines 建议的方法比持续延迟要好得多。
45-90 seconds.
For more information, see the GPS Time To First Fix article at Wikipedia.
But you can never know when the user actually has view to the satellites or not, maybe they are still inside when they start your program, so the approach suggested by Matthew Vines is much better than a constant delay.
具体到手机,我有一部带有 GPS 接收器的摩托罗拉手机,但它的性能非常糟糕 - 可能需要大约 5 分钟才能修复,而我的独立蓝牙接收器只需不到一分钟即可完成修复。
无论如何,你为什么在固定超时后宣布失败?为什么不,在经过一段合理的时间(比如一分钟)后,显示一条消息,内容是“GPS 修复仍然不可用;但我仍在尝试”,如果用户吃饱了,可以随时取消向上?您希望用户如何处理您建议向他提供的失败消息?
Cellphone-specifically, I've had a Motorola phone that had a GPS receiver, but was horrendously bad at it - it could take it around 5 minutes to get a fix where my standalone Bluetooth receiver would manage in less than a minute.
Why are you declaring failure after a fixed timeout anyway? Why not, after a reasonable time has passed (say, a minute), display a message to the tune of "GPS fix still not available; but I'm still trying" with a possibility to cancel at any time if the user is fed up? What do you expect the user to do with the failure message you're proposing to give him?
当需要冷启动时,接收器必须下载全套星历数据,这些数据从 GPS 卫星以 30 秒的周期广播,并每 30 秒重新传输一次。
所以我想说,在宣布失败之前等待 60-90 秒(两个或三个星历周期)是合适的时间。
http://www.navigadget.com/ index.php/gps-knowledge/ttff-time-to-first-fix
请注意,如果设备需要下载年历,则启动时间可能会更长(大约 12.5 到 15 分钟)。这称为工厂 TTFF(首次修复时间)。
When a cold start is required, the receiver has to download a full set of Ephemeris data, which is broadcast from the GPS satellite over a 30 second cycle and re-transmitted every 30 seconds.
So I would say that 60-90 seconds (two or three Ephemeris cycles) would be a suitable time to wait before declaring failure.
http://www.navigadget.com/index.php/gps-knowledge/ttff-time-to-first-fix
Note that if a device requires an almanac download, the startup time can be much longer (on the order of 12.5 to 15 minutes). This is referred to as a Factory TTFF (Time to First Fix).