简体   繁体   English

当应用程序处于后台或运行状态时,处理推送通知,而不是在应用程序终止时

[英]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.

相关问题 应用未运行/应用终止时如何处理推送通知 - How to handle push notification when app is not running/app is terminated 当应用程序未运行或处于后台状态时,如何处理推送通知有效负载而不点击它 - How to handle push notification payload without tapping it when the app is in not running or background state 应用程序终止时推送通知 - Push notification when app is terminated 当应用未运行(终止)时,通知应用有关远程推送通知的信息 - Notify the app about remote push notification when the app is not running (terminated) 应用未运行/应用终止时如何获取推送通知 - How to get push notification when app is not running/app is terminated 处于“未运行”状态时在iOS应用中推送通知 - Push notification in iOS app when “Not running” state 当应用在后台运行时无法处理推送通知,收到推送但未点击横幅或警报 - Can't handle Push Notification when the app is running in Background, receives push but didn't click on the banner or alert 应用终止时响应推送通知 - responding to push notification when app is TERMINATED 在应用程序运行且打开通知栏时处理推送通知 - Handle push notification when app is running and notification tray is opened 当应用程序在后台时推送通知 - Push notification when app in background
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM