I'm able to see the notification in system tray when the app is in Background.
But, I would like the notification to be visible in system tray even if the app is in Foreground.
I tried the following on Android:
https://fcm.googleapis.com/fcm/send
as described here with both data
and notification
paylods: Again, I can only see the notification in system tray when the app is in background.This document mentions:
Messages with both notification and data payload, both background and foreground. In this case, the notification is delivered to the device’s system tray, and the data payload is delivered in the extras of the intent of your launcher Activity.
What am I missing?
I'm using Android and Cordova/Ionic.
If you want a notification to appear when the app is in the foreground, you will have to send a message with a data payload, then write code to handle that in your app, as described by the documentation you referenced.
When you send a message with a notification payload, FCM works exactly as you described. When then app is in the background, it will display a notification for you. When in the foreground, it will not.
Please note that data and notification payloads behave differently, as described in the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With