0

I am triggering the notifications from the server using FCM using notification parameter looks like this:

"notification": { "title": "Test Title", "body": "Test Body" }

The notification's title & body is displayed as expected when the app is in background while the notification is being triggered. But it doesn't show the body if the app is in foreground while the notification is being sent.

The one triggered when the app was in foreground. The body is missing here. the one triggered when the app is in foreground

The one triggered when the app was in background - expected behavior the one triggered when the app is in background

They both were triggered using the same code/endpoint/data etc. but at different times. Only difference of these two is that one was triggered when the app was in background and the other wasn't.

Do you think this is related to Firebase API request or something to be configured on mobile app side?

Tested on Android 8.1.0

Can Geliş
  • 1,454
  • 2
  • 10
  • 19
  • Possible duplicate of [How to handle notifications with FCM when app is in either foreground or background](https://stackoverflow.com/questions/48897883/how-to-handle-notifications-with-fcm-when-app-is-in-either-foreground-or-backgro) – Sumit Shukla Jul 31 '19 at 15:49
  • Can you post your code?? that is showing notification in tray. – Naitik Soni Aug 01 '19 at 06:17

1 Answers1

0

Seems like the notifications are not generated automatically when the app is in foreground and the mobile side is missing the body in the notification builder in onMessageReceived handler.

Nothing to be fixed for the backend side.

Can Geliş
  • 1,454
  • 2
  • 10
  • 19