Firebase Cloud Messaging Not Showing Notification Bar When App Is Open
Solution 1:
What you're observing is is how notification type messages work on Android. When your app is in the foreground, you will not see a notification in the tray.
Please read the documentation on handling messages to understand what to expect. Especially see the "in summary" box that tells you how message handling is different between foreground and background states of your app. Not that when your app is in the foreground, you can only expect that your message will be seen in onMessageReceived
. You can construct a notification there yourself, if needed.
Solution 2:
The default implementation will not show a notification when your application is in the foreground. You will need to handle onMessageReceived(...)
yourself and create and display a notification as needed.
From the documentation:
Firebase notifications behave differently depending on the foreground/background state of the receiving app. If you want foregrounded apps to receive notification messages or data messages, you’ll need to write code to handle the onMessageReceived callback. For an explanation of the difference between notification and data messages, see Message types.
Post a Comment for "Firebase Cloud Messaging Not Showing Notification Bar When App Is Open"