Handle the data payload without user tapping on the notification?

前端 未结 2 1887
日久生厌
日久生厌 2021-01-06 06:14

When in the background, apps receive the notification payload in the notification tray, and only handle the data payload when the user taps on the notificatio

2条回答
  •  情深已故
    2021-01-06 07:04

    Basing from the FCM docs on Handling Messages:

    App state   Notification        Data                Both
    Foreground  onMessageReceived   onMessageReceived   onMessageReceived
    Background  System tray         onMessageReceived   Notification: system tray
                                                        Data: in extras of the intent.
    

    It's not specifically handled ONLY by tapping on the Notification. You may handle it in the onMessageReceived(). Pretty sure the tap action also depends on how you implement it.

    If you intend for it to do something else, do provide more details.

提交回复
热议问题