I have an Android app that's in the background. I've registered it with Firebase and have been able to successfully retrieve it's token, as well as sending messages to it via the Firebase Console Manager (FCM).
When I send test messages via FCM, when the app is in the foreground the
onMessageReceived(remoteMessage:RemoteMessage)
call back API for my FirebaseMessagingService
derived class gets triggered. I can then call remoteMessage.notification!!.body
and obtain it's payload. This is the documented behavior so it's working as expected.
When the app is in the background though (say I press the home key), and I send the test message, that event doesn't get called but instead a notification shows up on the Android device, which is also the expected behavior. So far so good.
However, when I click on the notification in the notification channel, it brings the app to the foreground. However, when the app is launched like that - how does one retrieve the push notification payload? The onMessageReceived
isn't triggered, and I'm having a hard time finding the answer to this in Android's documentation.
Any indication as to how to obtain that?
Thanks