0

When my app receives a push notification I can click on it and I can receive its data from the activity's intent.extras in my Fragment.

However when I receive a push notification and click on the app icon instead (with the notification badge) - it doesn't hold intent.extras.

So if I perform the latter, how can I access the data from the notification (such a title, body) etc?

Zorgan
  • 8,227
  • 23
  • 106
  • 207

1 Answers1

3

try this
getIntent().getExtras().getString("s");

  • No intent data is coming through to my activity when I open the app by clicking on the app icon. Intent data only comes through when I click on the push notification. – Zorgan Jul 20 '19 at 22:53
  • According to docs, if you want to process background message arrival, you have to send 'click_action' with your message. But it is not possible if you send message from Firebase console, only via Firebase API. It means you will have to build your own "console" in order to enable marketing people to use it. So, this makes Firebase console also quite useless! – Mirza Sijawal Jul 20 '19 at 23:08