[英]Handle push notification when app is in Background or Running state not when app is terminated
I am working in one of project where client requirements is like show Push notifications till app is not terminated . 我正在一个项目中工作,其中客户要求就像显示推送通知,直到应用程序未终止。 Push Notifications is done with Firebase Integration by sending FCM token to the Backend.
通过将FCM令牌发送到后端,使用Firebase集成完成推送通知。 I have also have one API for Deleting FCM token when app is terminated but could not execute around 30 seconds till app is Terminated .IS there anyway to check from App side when Push Notifications arrives show only when the app is running or background state.
当应用程序终止时,我还有一个用于删除FCM令牌的API,但是在应用程序终止之前无法执行大约30秒。无论如何,只有当应用程序正在运行或处于后台状态时才显示推送通知到达时从应用程序侧检查。
Receive displayed notifications for minimum iOS 10 version. 接收最低iOS 10版本的显示通知。
// Function call when App is in foreground State
func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping
(UNNotificationPresentationOptions) -> Void) {
}
// Function call when App in Background State
func application(_ application: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable : Any],
fetchCompletionHandler completionHandler: @escaping
(UIBackgroundFetchResult) -> Void) {
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.