是否可以仅使用区域监控+ GSM并获得不超过5公里的水平精度?

发布于 2024-12-14 02:19:30 字数 1449 浏览 4 评论 0原文

我想分享我执行的测试场景的信息,并请您分享您在区域监控方面的经验。因此,我注册了两个相对的区域(A 和 B),半径为 5 公里,所需精度为 1 公里,它们之间的距离为 20 公里。但是,从 A 到 B 时,我没有收到任何 didEnterRegion/didExitRegion 事件。在我的应用程序原型中,我还放置了两个按钮(用于测试目的):一个启动重大更改,另一个启动标准位置监控。两者都在屏幕日志上打印 didUpdateToLocation 事件。

因此,在到达 B 区中心并对不可预测的功能感到非常恼火之后,我启用了重要的监控。之后,我收到了几个 didUpdateToLocation,horizo​​ntalAccuracy 约为 8.5 公里!哇,这很痛苦,因为我想做的就是有一个功能,可以通知用户,他想要的位置是距离他当前位置位置半径 5 公里的某个地方,并且我想依赖 GSM 小区三角位置仅检测方法(用于保护电池)。

那么,回到我的例子。在出现如此大的 8 公里误差后,我启用了最准确的标准监控(GPS)。宾果,我收到了水平精度为 399 m 的 didUpdateToLocation 事件,直到那时,我才从我的初始位置(区域 A)收到了 didExitRegion 事件,以及另一个带有 didEnterRegion (B)的事件。 didUpdateToLocation 的另一个更新更准确一些 - 50m。

在之前的场景中,我的准确性也不稳定。有时有4公里水平精度,有时更少。但主要问题是,如果我们想节省电池(苹果在文档中教我们这一点),那么我们可以只依靠区域监控+ GSM 而不使用 GPS 吗?有一个“正确使用区域监控”的 Apple 代码示例(这里),但是那里有一些不可接受的事情:

1)他们声明示例代码仅适用于 iPhone4,尽管 Apple文档指出,iOS4.0+支持区域监控和重要监控。很酷,哈?

2) 示例代码使用了全部 3 种定位方法:significant、standard、region。它始终使用区域监控,但此外还使用最准确的标准位置。当应用程序进入后台时,它会停止标准并开始重大变化监控。当进入前台时,应用程序会停止并开始标准位置。似乎苹果文档相当模糊,不清楚如果我们只使用区域监控,我们会得到什么惩罚(horizo​​ntalAccuracy),或者我们是否总是使用所有三种方法?

3) Apple 文档指出,我们需要保留电池并根据需要使用最低限度的定位服务,如果我们不需要 GPS,那么我们应该使用 GSM(例如,1 - 3 公里所需的精度)。但示例代码使用最佳期望精度 (GPS) 进行区域监控和标准监控(当应用程序位于前台时)。我确实知道 GPS 可以解决我在误差和准确性方面的所有问题,但是仅使用 GSM 怎么样?在我的场景中获得 8.5 公里水平精度后,我不确定是否可以使用区域监控,因为它无法提供至少 5 公里的可接受误差。

I would like to share the info of my performed testing scenarios and to ask you to share your experience with region monitoring. So, I have registered two opposite regions (A and B) with 5 km radius and 1 km desiredAccuracy, with the 20 km distance between them. However, I haven't received any didEnterRegion/didExitRegion events when traveling from A to B. In my app prototype, I also put two buttons (for testing purposes): one starts significant change and another standard location monitoring. Both prints didUpdateToLocation events on-screen-log.

So, after getting to the center of region B and being very annoyed about the unpredictable functionality, I have enabled significant monitoring. After that, I have received several didUpdateToLocation with horizontalAccuracy of ~8.5 km! Wow, that hurts, because all I want to do is to have a functionality where a user would be notified, that his desired place is somewhere in radius of 5 km from his current location position, and I want to rely on GSM cell triangular location detection method only (for preserving the battery).

So, back to my case. After getting such a big 8 km error, I have enabled standard monitoring with best accuracy (GPS). And bingo, I have received didUpdateToLocation event with horizontal accuracy of 399 m, and only then, I have received didExitRegion from my initial place (region A), and another event with didEnterRegion (B). Another updates from didUpdateToLocation where a little bit more accurate - 50m.

In previous scenarios, I was getting unstable accuracy also. Sometimes there were 4 km horizontalAccuracy, sometimes less. But the main question that is, if we want to preserve the battery (Apple teaches us that in docs) then can we rely only on region monitoring + GSM without using GPS? There's a sample of Apple code with "proper use of region monitoring" (here), however there are some unacceptable things there:

1) They state that sample code works only for iPhone4, though Apple docs state that both region monitoring and significant monitoring are supported on iOS4.0+. Cool, ha?

2) The sample code uses all 3 location methods: significant, standard, region. It uses region monitoring all the time but in addition in uses standard location with best accuracy. When app enters background it stops standard and starts significant change monitoring. When entering foreground then app stops significant and starts standard location. Seems like apple docs are quite vague, it's unclear what penalties (horizontalAccuracy) do we get if we use only region monitoring, or do we have always to use all three methods?

3) Apple docs state that we need to preserve the battery and to use as minimum location services as we need, if we don't need GPS then we should use GSM (for example, 1 - 3 km desired accuracy). But the sample code uses best desired accuracy (GPS) both for region monitoring and standard monitoring (when app is in foreground). I do understand that GPS would solve all my problems with errors and accuracy, but what about using GSM only? After getting 8.5 km horizontalAccuracy in my scenario, I'm not sure is it possible to use region monitoring at all because it's unable to provide at least 5 km acceptable error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

狼亦尘 2024-12-21 02:19:30

根据我的经验,区域监控非常准确,不会对电池寿命造成重大损失。我有一个只有30-50米宽的区域的使用场景。准确性完全没有问题。我要说的一件事是,我只针对 iPhone 4 及更高版本的设备。如果我想支持 3GS 型号,我需要实施您提到的一些更改。

当纯粹依赖 -startMonitoringForRegion 时,您的更新会自动触发 -didEnter 和 -didExit 事件。这些是通过位置跟踪事件的组合触发的。重大变化、手机信号塔传输、WiFi 连接、另一个应用程序请求位置等等。当这些其他共享位置事件触发回调时,操作系统会进行处理。根据我的经验,它非常准确。但这仅适用于 iPhone 4 及更高版本。

我还使用了 Apple 的示例应用程序来进行设置,但文档中没有提供有关何时/何处获取触发器的详细信息。您可以在 中了解 Apple 提供的内容位置意识指南。希望这会有所帮助。

In my experience, the region monitoring is pretty accurate without a significant loss to battery life. I have a use scenario of regions that are only 30-50 meters wide. No issues at all with accuracy. One thing I will say, I have only targeted iPhone 4 devices and up. I will need to implement some of the changes you talk about if I want to support the 3GS models.

When relying purely on -startMonitoringForRegion, your updates automatically trigger on the -didEnter and -didExit events. These are triggered through a combination of location tracking events. Significant changes, cell tower transfers, connection to WiFi, another app requests location, and a few others. The OS handles when the callbacks are triggered from these other shared location events. In my experience, it has been very accurate. But this is only for iPhone 4 and up.

I also used the example app from Apple to get things set up, but there isn't a lot of detail in the documentation about the specifics of the when/where you will get your trigger. You can read up on what Apple provides in the Location Awareness Guide. Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文