如果后台应用程序无法自动启动,Cardcase如何在位置更改时启动? [英] If background applications can't launch automatically how does Cardcase launch on a location change?

查看:79
本文介绍了如果后台应用程序无法自动启动,Cardcase如何在位置更改时启动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Cardcase应用程序可以让您知道您是否与您之前有过关系的商店(如果您已设置了支付选项卡等)。

The Cardcase application lets you know if you approach a shop which you have a previous relationship with (if you've set up a tab for payments there etc.).

如果后台运行的应用程序无法在设备启动时自动启动,那么这个应用程序是如何工作的?

If background running applications cannot be started automatically on device boot, how does this app therefore work?

编辑让我的问题更加清晰:我不是在问如何监控用于位置更改或如何监视背景中的位置更改。我的问题是,如果用户安装此应用程序,然后为某些位置添加一些选项卡,然后他们重新启动他们的iPhone,那么如果不支持在启动时启动应用程序启动时,该应用程序如何在他们接近某个位置时通知他们?

Edited to make my question clearer: I am not asking how to monitor for location changes or how to monitor for location changes in the background. My question is, if the user install this app, then adds some tabs for some locations, then they reboot their iPhone, then how can this app subsequently notify them when they approach a location if application launch on boot is not supported?

此应用程序(以及任何其他应用程序)必须依赖于每次设备重启后用户是否明确启动它?

Must this application (and indeed any other application) be dependent upon it being launched explicitly by the user following every device reboot?

推荐答案

您可以使用区域监控来执行此操作。您在CLLocationManager上使用此方法注册要监视的区域:

You can do this with region monitoring. You register regions that you would like to monitor with this method on CLLocationManager:

- (void)startMonitoringForRegion:(CLRegion *)region desiredAccuracy :( CLLocationAccuracy)准确度

然后,即使您的应用未运行,它也会在用户进入或离开该区域时在后台启动。

Then even if your app is not running, it will be launched in the background as the user enters or leaves the region.

来自Apple的 docs


如果您开始监控某个地区,您的申请随后是
终止后,如果跨越区域边界,系统会自动将其重新启动到后台
。在这种情况下,选项
字典传递给应用程序:didFinishLaunchingWithOptions:
应用程序委托方法包含密钥
UIApplicationLaunchOptionsLocationKey,表示你的
应用程序是由于与地点有关的事件。在
另外,创建一个新的位置管理器并分配一个委托
会导致传递相应的区域消息。

If you begin monitoring a region and your application is subsequently terminated, the system automatically relaunches it into the background if the region boundary is crossed. In such a case, the options dictionary passed to the application:didFinishLaunchingWithOptions: method of your application delegate contains the key UIApplicationLaunchOptionsLocationKey to indicate that your application was launched because of a location-related event. In addition, creating a new location manager and assigning a delegate results in the delivery of the corresponding region messages.

编辑

刚刚使用我自己的应用进行了测试。离开办公室之前重新启动了我的手机,应用程序像往常一样在我的驱动器上启动。所以是的,这肯定会在重启后幸存下来。

Just tested this with my own app. Rebooted my phone before leaving the office, and the app was launched on my drive home as usual. So yes, this definitely survives a reboot.

希望有所帮助。

这篇关于如果后台应用程序无法自动启动,Cardcase如何在位置更改时启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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