Push notification not landing correctly when app on background

We have the Push notifications setup the way described in the docs:


We have our implementation of FirebaseMessagingService in which we create our notification with our payload to redirect user to the appropriate screen.

However when the app is in background the FirebaseMessagingService is not called yet there are push notifications created with no fields and when clicking on them, the app comes to foreground and that is it.

I was thinking that perhaps the sdk is creating those notifications, so is there a way to stop this behaviour? or is there a way to control the payload when that happens?

This is working as intended. In FirebaseMessagingService , notification messages are delivered to your onMessageReceived callback only when your app is in the foreground. If your app is in the background or closed then a notification message is shown in the notification tray, and any data from that message is passed to the intent that is launched as a result of the user tapping on the notification. For more information, please visit here.

When the intent is launched you can use the

To be more specific on our code, if the notification data payload includes the key ‘messageData’ inside ‘data’ json. We will need to use

Please allow us to ask for more information from the user. Thank you very much.

" I checked the github issue and went through the feedback written by the devs but it only describes the working flow , in which we are doing fine.

My inquiry was all about the case where the app is in the foreground. The push notifications are appearing but not through FirebaseMessagingService and the final intent fired to the app when the push notification does not have any extras. In other words my question was whether the sdk creates those notifications in a way that does not use FirebaseMessagingService when the app is running and if a user is logged in. "

All of the push notifications are sent by our server, and the Android OS manages the way to create or present them.
As an SDK, we don’t intercept or modify anything from the OS.