GeoCoordinateWatcher 必须触发多少次?
我的 Wp7(Mango)应用程序需要知道用户的位置,以便在数据库中搜索最近的对象。但我想在欢迎屏幕上显示结果,所以我需要尽快找到我的位置。我编写了一段代码,该代码启动 GeoCooperativeWatcher
(高精度和最小阈值),并在第一次触发时停止它,并将位置发送到 Web 服务,该服务返回有问题的对象。
测试后,我去把它展示给城镇的另一边。我启动了它,但让大家觉得有趣的是,它显示了一个完全错误的结果 - 我知道为什么:它仍然认为我在家!
GPS 更新需要多长时间? 我如何知道我最终获得了当前位置?在停止之前我应该允许 GeoCooperativeWatcher
触发多少次?
My Wp7 (Mango) app needs to know the location of the user in order to search for the nearest object in the database. But I want to display the result on the welcome screen, so I need my location ASAP. I've written a code that starts the GeoCoordinateWatcher
(on high precision and minimal threshold), and on the first firing it stops it, and sends the location to the webservice, which returns the object in question.
After I tested it, I went to present it, to the other side of the town. I started it and for everyone's amusement it showed a completely wrong result - I know why: it still thought I was at home!
How long does it take for the GPS to update? How will I know that I finally got my current location? How many times should I allow the GeoCoordinateWatcher
to fire before stopping it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在此处查看答案:
http:// /awkwardcoder.blogspot.com/2011/09/geo-location-on-wp7-dont-trust-first.html
基本上,不断要求更新,直到有一个在您的范围内开始向他们提出要求。
Check out the answer here:
http://awkwardcoder.blogspot.com/2011/09/geo-location-on-wp7-dont-trust-first.html
Basically, keep asking for updates until one is in the range from when you started requesting them.
您有
StatusChanged
事件用于处理例如旧用户位置(在家)。当设备状态就绪时 - 您拥有当前位置(但可能不准确)。因此,如果您需要高精度位置,请使用HorizontalAccuracy
;)You have
StatusChanged
event for handling such as old user location (at home). When device status is ready - you have current location (but it can be inaccurate). So, useHorizontalAccuracy
if you need high precision position ;)