pusher / pusher-websocket-android

Library built on top of pusher-websocket-java for Android. Want Push Notifications? Check out Pusher Beams!
MIT License
36 stars 12 forks source link

Get initial notification data #23

Closed Rhysjc closed 7 years ago

Rhysjc commented 7 years ago

Is there any way we can get the data field on a notification when the app has been opened by tapping the notification?

It seems like the listener we register with setFCMListener only gets called when the app is running.

Rhysjc commented 7 years ago

Found a solution to this, submitting it here for anyone having the same issue.

It seems that Firebase creates an Intent when you open an app via a notification tap. All you need to do is get your intent with getIntent(), then all key/value pairs from your data object will be available via intent.getExtras().