开发者

Start a location-aware background service in iOS on boot

开发者 https://www.devze.com 2023-03-22 19:36 出处:网络
Applications can register for significant location changes. (Recommended) The significant-change location service offers a

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 o开发者_如何学Cr 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.

From https://developer.apple.com/library/archive/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.


No, you cannot have your application run automatically when the phone is started. In addition, if the user starts your application manually and puts it into the background, the system may eventually kill it when it needs the memory.


"Including the voip value in the UIBackgroundModes key lets the system know that it should allow the app to run in the background as needed to manage its network sockets. An app with this key is also relaunched in the background immediately after system boot to ensure that the VoIP services are always available."

check iOS docs here

Although if you do this for an illegitimate reason I am guessing your app will either not get approval or get booted quickly.

0

精彩评论

暂无评论...
验证码 换一张
取 消