适用于iOS 5的Geofence API [英] Geofence API for iOS 5

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

问题描述

我想建立一个应用程序,可以在整个城镇设置一定数量的地理围栏正方形区域,我知道我可以通过在后台启用位置来实现此目的,并检查这些坐标以确定它们是否位于我的区域中。

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

相反,我想知道是否有一个新的API或者即将推出的API,可以让你设置一个地理围栏,只有在系统内部或附近时才通知系统,而不是不断监视你的位置。



是否有可能?

我发现了以下问题,但我找不到其他的东西:
http://www.quora.com/Is-the-geo-fence-functionality-built-into-iOS5s-Reminders-application-available-as-a-publi c-facing-API


在我看来,还有更多的东西可以用于围栅,然后跟踪GPS并将其与一系列兴趣点进行比较。如果我设置提醒应用程序以提醒我今晚我必须在室内走路时与我的室友同行,那么我可以在屏幕顶部看到位置图标。



如果我打开多任务栏并删除提醒,位置图标仍然存在,表示电话正在跟踪我,但它是提醒应用的独立任务。



如果我设置了一个具有后台位置跟踪的应用程序,并从多任务栏中删除,位置图标随应用程序一起消失。这让我相信iOS 5.x会有或将会有一个针对geo fencing的API,这将允许应用程序向系统发布一系列坐标,并根据这些点的接近度接收本地通知。



有没有类似的东西存在还是没有?

谢谢

未来用户的更新



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



Apple文档摘录:


在指定时应始终保持审慎要监控的
区域集合。区域是一个共享系统资源,
系统范围内可用区域的总数是有限的。


解决方案

您应该查看 startMonitoringForRegion:desiredAccuracy: 方法 CLLocationManager


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的Geofence API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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