I am using Firebase Cloud Messaging on Android and I ran across the following issue. It occurs when handling notifications received while the application is in background. The documentation states the following:
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 launcher Activity.
Even though this is what happens most of the times, I have found a few edge cases when the launcher activity is not opened. Instead, the application is simply resumed from background on the last activity in the backstack, leaving me with no way of obtaining the payload.
I can reproduce this issue every time by killing the process and having the application opened via a notification from the system tray. The first time the notification is tapped, the launcher activity gets opened as described in the docs, but by tapping on any subsequent notification, the application is simply resumed without going through the launcher activity first.
I am not sure if I am doing something wrong or if there is a bug in Firebase's SDK. Do you have any idea why this might be happening?
The notification I am testing with is a display-message notification (not data notifaction) and it also has a payload.
{
"to": "d-3qyvyqefU:APA91bG_nHNYeYuKwB3oIvRKStVgSyelTIhX6rtu6LGPAjgo-LGDVk9iFO5LWZ-XFMeeRVkZm0suMyJAnWORWbZlMaVcHmhFTZOKPI_A-D2wYXM0SIIT8pZZ2g4W55S1bz9YD5y625fv",
"priority": "high",
"content_available": true,
"registration_id": "d-3qyvyqefU:APA91bG_nHNYeYuKwB3oIvRKStVgSyelTIhX6rtu6LGPAjgo-LGDVk9iFO5LWZ-XFMeeRVkZm0suMyJAnWORWbZlMaVcHmhFTZOKPI_A-D2wYXM0SIIT8pZZ2g4W55S1bz9YD5y625fv",
"collapse_key": "Collapse Key",
"data": {
"type": "default",
"person": "2123435",
"token": "asdmmio23j4123azde3"
},
"notification": {
"type": "default",
"title": "Howdie!",
"body": "Say hi to your new friend!"
}
}