I am using FCM for Simple notification
When the app is in foreground, everything working properly. I am getting a notification plus the data message inside the onMessageReceived
method.
But when app is in background, I am getting notification in system tray. And when I click on the control, it goes to the main activity. And When I parse intent.getExtras();
, I am getting only this key data - google.sent_time
, from
, google.message_id
, collapse_key
.
How to get the notification message title and Message which is visible in system tray from intent.getExtras()
?
I am using FCM console for sending notification I don't have my dedicated server to do this.
Code for receiving the message:
final Bundle extras = intent.getExtras();
final Set<String> keySet = extras.keySet();
final Iterator<String> iterator = keySet.iterator();
while (iterator.hasNext()) {
final String key = iterator.next();
final Object o = extras.get(key);
System.out.println(key + ":" + o);
}