在启动时在iOS中启动位置感知后台服务 [英] Start a location-aware background service in iOS on boot

查看:102
本文介绍了在启动时在iOS中启动位置感知后台服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


应用程序可以注册重要的位置更改
(推荐)重要变更位置服务提供
低功耗方式来接收位置数据,强烈推荐用于不需要高精度位置数据的
应用程序。使用此
服务,仅当用户的位置
发生显着变化时,才会生成位置更新;因此,它是社交应用程序或
应用程序的理想选择,它们为用户提供非关键的,与位置相关的
信息。如果在更新发生时暂停应用程序,系统会在后台唤醒它以处理更新。 如果
应用程序启动此服务然后终止,系统
会在新位置变为
可用时自动重新启动应用程序
。该服务适用于iOS 4及更高版本,仅适用于包含蜂窝无线电的
设备。

Applications can register for significant location changes. (Recommended) The significant-change location service offers a low-power way to receive location data and is highly recommended for applications that do not need high-precision location data. With this service, location updates are generated only when the user’s location changes significantly; thus, it is ideal for social applications or applications that provide the user with noncritical, location-relevant information. If the application is suspended when an update occurs, the system wakes it up in the background to handle the update. If the application starts this service and is then terminated, the system relaunches the application automatically when a new location becomes available. This service is available in iOS 4 and later, only on devices that contain a cellular radio.

来自 http://developer.apple.com/library/ios /#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html

当位置发生变化时,可以重新启动应用。但是,它可以在手机启动时自动启动吗?文档不太清楚。

An app can be relaunched when the location changes. However, can it be started automatically when the phone is started? The documentation isn't quite clear.

推荐答案

该服务将在用户启动您的应用程序时启动,如果已关闭则终止。如果应用程序在后台运行,该服务将继续运行。

The service will start when the user launches your application, and terminate if it is closed. The service will remain running if the application is running in the background.

出于安全考虑,开发人员无法将服务集成到操作系统中。

Developers cannot integrate services into the OS, for security purposes.

这篇关于在启动时在iOS中启动位置感知后台服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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