后台位置跟踪:iOS [英] Background location tracking: iOS

查看:180
本文介绍了后台位置跟踪:iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Apple的重要位置变更服务之间做出决定,并自己定期启动/停止位置管理员。这就是Apple所说的:

I'm trying to decide between Apple's significant location change services and start / stopping the location manager regularly myself. This is what Apple says about it :


收集位置数据是一项功耗密集型操作。它涉及启动机载无线电并查询可用的蜂窝塔,Wi-Fi热点或GPS卫星,这可能需要几秒钟。让标准位置服务长时间运行会耗尽设备的电池电量。 (显着变化的定位服务通过仅监控电池塔的变化大大减少了电池消耗,但该服务仅适用于具有蜂窝无线电的设备。)对于大多数应用,通常足以建立初始定位然后获取仅在此之后定期更新。如果您确定需要定期更新职位,则应尽可能使用重大变更位置服务;否则,您应该以最小化其对电池寿命的影响的方式配置标准位置服务的参数。

Gathering location data is a power-intensive operation. It involves powering up the onboard radios and querying the available cell towers, Wi-Fi hotspots, or GPS satellites, which can take several seconds. Leaving the standard location service running for extended periods can drain the device’s battery. (The significant-change location service drastically reduces battery drain by monitoring only cell tower changes, but the service works only on devices with cellular radios.) For most applications, it is usually sufficient to establish an initial position fix and then acquire updates only periodically after that. If you are sure you need regular position updates, you should use the significant-change location service where you can; otherwise, you should configure the parameters of the standard location service in a way that minimizes its impact on battery life.

所以,我的用例是否能够提醒用户他们是否在某个位置附近(约1公里)。我应该跳过重要的位置更新并每10分钟左右轮询一次位置管理员吗?

So, my usecase is to be able to alert the user if they are near (~1km) a certain location. Should I just skip Significant location updates and poll the location manager every 10 minutes or so myself?

谢谢,

Teja。

Thanks,
Teja.

推荐答案

考虑使用区域监控API。这是在支持iOS 4多任务处理时执行锁定的唯一方法。但要注意,它有点气质,特别是如果你想要监控许多地区。

Consider using the region monitoring API. It's the only way to do what you're locking for while supporting iOS 4 multitasking. Be warned, however, it's a bit temperamental, particularly if you want to monitor many regions.

如果您只是想知道用户何时在特定位置附近,我会避免使用重要的位置更改API。

I would avoid the significant location change API if you just want to know when a user is near a specific location.

这篇关于后台位置跟踪:iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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