从推送通知(FCM)获取数据,而无需单击通知

时间:2022-04-04 16:23:20

I already can manage push notifications from FCM when the app is in Foreground or background, when I do click in notification popup and open app "application didReceiveRemoteNotification" work without problem

我已经可以在应用程序处于Foreground或后台时管理来自FCM的推送通知,当我点击通知弹出窗口并打开应用程序“application didReceiveRemoteNotification”工作时没有问题

My problem is that i don't know how get notification push data if the user open the app normaly (do click in icon app instead of click in notification) and I would lost the data if he close the notification

我的问题是,如果用户正常打开应用程序,我不知道如何获取通知推送数据(点击图标应用程序而不是点击通知),如果他关闭通知我会丢失数据

2 个解决方案

#1


2  

If the app is in background state UINotification called application didReceiveRemoteNotification , If app is in open state UINotification called application:didFinishLaunchingWithOptions, And can't possible to get data without click on notification in iOS.

如果应用程序处于后台状态,则UINotification称为应用程序didReceiveRemoteNotification,如果应用程序处于打开状态UINotification,则称为application:didFinishLaunchingWithOptions,并且无法在未单击iOS中的通知的情况下获取数据。

#2


0  

check

UIApplicationLaunchOptionsRemoteNotificationKey or application:didFinishLaunchingWithOptions

UIApplicationLaunchOptionsRemoteNotificationKey或应用程序:didFinishLaunchingWithOptions

#1


2  

If the app is in background state UINotification called application didReceiveRemoteNotification , If app is in open state UINotification called application:didFinishLaunchingWithOptions, And can't possible to get data without click on notification in iOS.

如果应用程序处于后台状态,则UINotification称为应用程序didReceiveRemoteNotification,如果应用程序处于打开状态UINotification,则称为application:didFinishLaunchingWithOptions,并且无法在未单击iOS中的通知的情况下获取数据。

#2


0  

check

UIApplicationLaunchOptionsRemoteNotificationKey or application:didFinishLaunchingWithOptions

UIApplicationLaunchOptionsRemoteNotificationKey或应用程序:didFinishLaunchingWithOptions