2

I am going to use Firebase cloud messaging in my Android App to send reminder and notifications to users to get them more engaged with my app.

For that reason, I want to have a custom look of the notification. I have gone through the Cloud Messaging documentation but it only shows how to receive and build a notification when the app is in the foreground. The same does not work if the app is in the background. If the app is in the background then a normal notification is shown.

I have gone through many posts stating that I can leave the notification field blank and can put data on the data field but for me, the main problem is that I am not using my custom server to dispatch notification but I am using the Default Notification composer provided by Firebase.

Is there any way to show custom layout using Default Firebase Notification Composer irrespective of if the app is in the foreground or background?

Any Help will be grateful.

Rahulrr2602
  • 701
  • 1
  • 13
  • 34

1 Answers1

1

No, it is not possible to show custom layout notification using Default FCM panel when the app is in the background.

From docs:

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.

touhid udoy
  • 4,005
  • 2
  • 18
  • 31
  • 1
    Thanks for the clarification. Just one more doubt may be off topic? How can I send a Cloud Notification from Firebase Console which should open at a particular activity rather than my default activity? – Rahulrr2602 May 04 '19 at 15:32
  • 1
    @Rahulrr2602 It is not possible either as far as I know...see the highlighted section of my answer. *notification opens the **app launcher** by default*. A workaround might be, when you pass key-values via firebase console, it creates a notification, but when you click it, the key-value is passed as intent extra(stated in docs) in the launcher activity. When you get your intended extra, you might start your intended activity – touhid udoy May 04 '19 at 15:46
  • 1
    Thanks once again :) – Rahulrr2602 May 04 '19 at 15:47