Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handle the data payload without user tapping on the notification?

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 notification.

Is there any way to handle the data payload without user tapping on the notification?

like image 594
Mridul S Kumar Avatar asked Nov 08 '22 08:11

Mridul S Kumar


1 Answers

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.

like image 189
AL. Avatar answered Nov 15 '22 04:11

AL.