简体   繁体   English

终止后,通过推送通知启动应用程序

[英]Launch an app with push notification after it has been terminated

I was wondering if there was a way to wake up an app that has been terminated by the user on ios8-9. 我想知道是否有办法唤醒用户在ios8-9上终止的应用程序。 By terminated I mean double click on the home button and swipe up. 终止后我的意思是双击主页按钮并向上滑动。

Is it somehow possible to launch an app by sending a silent push notification so that didreceiveremotenotification gets fired and gives me some runtime ? 是否有可能通过发送静默推送通知来启动应用程序,以便didreceiveremotenotification触发了重新启动,并给了我一些运行时间?

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. 我的想法是发送静默推送通知以在后台启动应用程序并触发后台提取。

Short Answer: No That is not possible. 简答:不,这是不可能的。

Detail: 详情:

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) (远程通知实际上只是设置了content-available标志的普通推送通知)

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. 在这种情况下,用户必须重新启动应用程序或重新启动设备,然后系统才会再次尝试自动启动应用程序。

Reference: 参考:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 应用终止后继续NSURLConnection - Continue a NSURLConnection after the App has been terminated 应用终止后无法处理本地通知 - Unable to Handle Local Notification when app has been terminated 用户在后台收到推送后手动打开应用程序时获取推送通知有效负载 - Getting push notification payload when user opens app manually after push has been received in the background 应用程序终止时推送通知 - Push notification when app is terminated 安排并显示本地通知后,启动iPhone应用程序需要什么代码? - What code is required to launch an iPhone app after a local notification has been scheduled and displayed? 在将应用提交到应用商店后添加iOS推送通知 - Add iOS push notification after app has been submitted to app store 应用终止后发送本地通知 - Sending local notifications after the app has been terminated 应用终止后,使用NSNotification在UIViewController中处理UILocalNotification - Handle UILocalNotification in UIViewController using NSNotification after the app has been terminated 删除并重新安装应用后,为推送通知权限重新生成iOS系统警报 - Regenerate iOS system alert for push notification permission AFTER app has been deleted and reinstalled 应用程序终止时的 Swift IOS 启动通知 - Swift IOS launch notification when app terminated
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM