终止后启动带有推送通知的应用程序 [英] Launch an app with push notification after it has been terminated

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

问题描述

我想知道是否有一种方法可以唤醒已在ios8-9上被用户终止的应用程序.终止是指双击主页按钮并向上滑动.

I was wondering if there was a way to wake up an app that has been terminated by the user on ios8-9. By terminated I mean double click on the home button and swipe up.

是否可以通过发送无声推送通知来启动应用程序,从而触发didreceiveremotenotification并给我一些运行时间?

Is it somehow possible to launch an app by sending a silent push notification so that didreceiveremotenotification gets fired and gives me some runtime ?

我注意到有相当一部分用户终止了我的应用程序.由于我非常依赖于后台获取,因此这是一个问题.我的想法是发送无声推送通知,以在后台启动应用程序并触发后台获取.

I have noticed that a fair share of my users terminate my app. As I rely heavily on background fetch, this a problem. My idea was to send silent push notifications to launch the app in the background and trigger background fetch.

推荐答案

简短答案:否这是不可能的.

详细信息:

当服务器上有任何新内容时,您将向应用程序发送远程通知以进行通知. (远程通知实际上只是设置了content-available标志的普通推送通知)

When there is any new content on server you will send Remote Notification to your application to inform about that. (A Remote Notification is really just a normal Push Notification with the content-available flag set)

应用程序收到此远程通知时,它将调用以下方法:

When application received this Remote Notification it calls following method:

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

此方法的文档中清楚地写着:

In Documentation of this method it is clearly written:

但是,如果用户 强制退出了.在这种情况下,用户必须重新启动您的应用 或在系统尝试启动您的应用程序之前重新启动设备 再次自动.

However, the system does not automatically launch your app if the user has force-quit it. In that situation, the user must relaunch your app or restart the device before the system attempts to launch your app automatically again.

参考:

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

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