I was firebase console to send notifications. It sends notifications to system tray directly. I want to get payload from them when user taps on them.
When your app is in the background, Android directs notification
messages to the system tray. A user tap on the notification opens the
app launcher by default.
This includes messages that contain both notification and data payload
(and all messages sent from the Notifications console). In these
cases, the notification is delivered to the device's system tray, and
the data payload is delivered in the extras of the intent of your
I dumped extras bundle and found the answer.
These are they keys that I was looking for:
Apart from these you can directly use the keys that you used for custom data (while sending message).
when we fire messages from firebase console, I think only custom data that we sent along can be received from extra's intent. Title,message etc I cannot retrieved from here
As also observed by others, I don't think it is possible to extract title and message from extras intent. I found a workarond by passing them again with a separate key. Some code how to extract data from extras intent is
Bundle Extras = getIntent().getExtras(); public static String Content_KEY = "NotificationContent"; //alterative to message String Content = Extras.getString(Content_KEY);
I don't remember exact names, but there are 2 modes to send a message.
First mode is what firebase console uses. It sends messages directly
You will have to handle both, I ended up by sending notification from my app itself to system tray if I got it in onMessageReceived so that I could manage them from same code that handles extras intent in main activity.
You will also loose data if notification is lost.