iOS 5 的地理围栏 API [英] Geofence API for iOS 5

查看:16
本文介绍了iOS 5 的地理围栏 API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想构建一个应用程序,可以在整个城镇设置一定数量的地理围栏方形区域,我知道我可以通过在后台启用位置来实现这一点,并检查这些坐标以确定它们是否在我的区域内感兴趣.

但这意味着会收到来自系统的许多通知,并且会影响电池性能.

相反,我想知道是否有新的 API 或者可能即将推出的 API,可以让您设置地理围栏,并且只有当您在其中或附近时才会收到系统通知,而不是持续监控您的位置.

这可能吗?

我找到了以下问题,但找不到其他问题:http://www.quora.com/Is-the-geo-fence-functionality-built-into-iOS5s-Reminders-application-available-as-a-public-facing-APIp>

在我看来,除了跟踪 GPS 并与一系列兴趣点进行比较之外,地理围栏还有更多功能.如果我将提醒应用程序设置为提醒我今晚我必须在我进来时遛我的室友狗,那么我可以在屏幕顶部看到位置图标.

如果我打开多任务栏并删除提醒,位置图标仍然存在,表明手机正在跟踪我,但它是提醒应用程序的独立任务.

如果我设置了具有后台位置跟踪功能的应用程序,并从多任务栏中删除,则位置图标会随应用程序一起消失.这让我相信,iOS 5.x 已经或将会有一个用于地理围栏的 API,这将允许应用程序将一组坐标发布到系统并根据与这些点的接近程度接收本地通知.

是否存在类似的东西?

谢谢

未来用户更新

每个应用似乎有 10 个区域的限制,可以随时监控(我的个人测试),因为这是共享资源.

Apple 文档 提取:

<块引用>

在指定要监控的区域集.区域是共享的系统资源,并且系统范围内可用的区域总数是有限的.

解决方案

你应该看看 startMonitoringForRegion:desiredAccuracy: 方法在 CLLocationManager 上.p>

I want to build an application that can set up a set amount of geo-fenced square regions across town, I know I could achieve this by enabling location in the background, and check those coordinates to determine if they are in my area of interest.

But that would mean receiving many notifications from the system and would hit the battery performance.

Instead I wondered if there was a new API or possibly an upcoming one that would let you set a geo fence and only be notified by the system if you're inside of that or close by, rather then monitor your location constantly.

Is that possible ?

I found the following question, but I can't find much else: http://www.quora.com/Is-the-geo-fence-functionality-built-into-iOS5s-Reminders-application-available-as-a-public-facing-API

It would seem to me that there is something more to geo fencing then tracking the GPS and comparing to an array of points of interest. If I set the reminders app to remind me that I have to walk my roommates dog tonight when I get in, then I can see the location icon at the top of the screen.

If I open the multitasking bar and remove reminders, the location icon persists, indicating the phone is tracking me, but it's an independent task to the reminders app.

If I set up an application with background location tracking, and remove from multitask bar, the location icon disappears with the application. This makes me believe that there is or will be an API for geo fencing coming for iOS 5.x, this would allow apps to post an array of coordinates to the system and receive local notifications based on the proximity to those points.

Does something similar exist or not yet ?

Thanks

UPDATE FOR FUTURE USERS

There seems to be a limit of 10 regions per app that can be monitored at any time (my personal testing), as this is a shared resource.

Apple Documentation extract:

You should always be judicious when specifying the set of regions to monitor. Regions are a shared system resource and the total number of regions available systemwide is limited.

解决方案

You should look at the startMonitoringForRegion:desiredAccuracy: method on CLLocationManager.

这篇关于iOS 5 的地理围栏 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆