在后台自动启动应用程序? [英] Launch app in background automatically?

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

问题描述

有没有办法坚持在后台的iOS应用,使得它启动时自动设备开启以后将重新启动,如果终止?我已阅读无论是VoIP和GPS服务几个职位。我的应用程序发送紧急短信与用户的位置。它需要保持活跃听遇险触发器。难道是可能与使用APNS服务器发送推送通知应用程序自动启动应用程序?

Is there a way to persist an iOS app in the background such that it starts up automatically when the device is turned on and will re-launch later if terminated? I have read a few posts on either voip and gps services. My app sends emergency SMS messages with the user's location. It needs to remain active to listen for distress triggers. Would it be possibly to start up the app automatically with sending push notifications to the app using an APNS server?

推荐答案

是的,您可以使用APNS启动您的应用程序。

Yes, you can start your app using APNS.

1)必须设置内容提供,以1在通知机构。

1) You have to set "content-available" to 1 in the notification body.

2)你必须实现:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler

3),并有合适的背景模式:<一href=\"https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW22\"相对=nofollow>背景模式

但要小心,你的用户可以在iPhone设置禁用后台应用刷新关闭这个功能。您可以在code检查:

But be careful, your users can turn this off by disabling Background App Refresh in the iPhone Settings. You can check this in code:

[UIApplication sharedApplication].backgroundRefreshStatus!=UIBackgroundRefreshStatusAvailable

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

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