0

I'm sending Push Notifications using Firebase Cloud Messaging. I've used different custom layouts (RemoteViews) for collapsed and expanded notifications. The problem is the notification with custom layouts only shows when the app is active/foreground. It shows the default/simple notification when the app is in the background or killed.

In the following screenshot the top notification is in case of the app is in the background or killed and shows without custom layouts and the below notification is in case of the app is active and shows with custom layouts (which I also want in case of app in background or killed). Screenshot of notification

Any help would be much appreciated, as I'm stuck in this problem.

AtifSayings
  • 756
  • 14
  • 23
  • if you are implementing new custom notification in onMessageReceived in your service, you should read [here](https://firebase.google.com/docs/cloud-messaging/android/receive?hl=en&authuser=0#handling_messages) that the message in handled by the service only in foreground – nope Aug 09 '23 at 20:47
  • you can check [here](https://stackoverflow.com/questions/76828580/is-there-a-way-to-run-code-when-fcm-message-is-received-even-when-app-is-killed) or [here](https://stackoverflow.com/questions/37358462/firebase-onmessagereceived-not-called-when-app-in-background) to learn more about that – nope Aug 09 '23 at 20:56

0 Answers0