FCM push notification without payload to Android device - push-notification

I have an angular application deployed as PWA, iOS and Android app (Capacitor). This app rely on Firebase Cloud Messaging for push notification:
In android, I test this with the FCM console, and, as you can see from this console.log
in the pushNotificationReceived event handler, I've title, body and data fields from the notification.
But when the notification is tapped (e.g. when the app is closed), I lose its informations, as you can see from this console.log in pushNotificationActionPerformed event handler:
Inside the "data" field I have no more info about the original push notification.
This happens only with android, iOS has 'gcm.notification.data' object and PWA 'body' object. where I can find all the info I need.
What am I missing in order to get those info also in android?

Relating on capacitor developer, this depends on Android OS:
https://github.com/ionic-team/capacitor/issues/4934

Related

Flutter Notification Sound for IOS Apps

I want to set custom sound to notification in my application which using firebase notification.
In android worked perfectly, but in IOS not working. I put audio file in ios/runner, but notification received silently.

Should all Firebase notifications open at the same time for iOS Flutter app?

I have implemented Firebase Messaging into my Flutter app. Everything is working fine for Android. On iOS, if I received 2 or more push notifications, when I open one of those push notifications or bring the app to the foreground, onResume is triggered for all of the notifications at the same time and all of the notification are removed from my lock screen. I would expect onResume to only get called for the selected notification and onResume not getting called at all if the app is opened or brought to the foreground without interacting with the notification banner. That is how it's working for Android.
Is this the expected behavior or is there a way around this?
UPDATE
I removed content_available: true from my payload and that stopped onResumed from getting called multiple times when the app is launched/resumed, but the unopened notifications are still disappearing.

Firebase messaging FCM link option of notification push message to foreground PWA does not work

I'm using onMessage() of Firebase Cloud Messaging JS SDK to receive push messages when my PWA is on foreground, then using these line of codes to show notification to user:
navigator.serviceWorker.ready.then(registration => {
registration.showNotification(title, options);
});
My push message is notification with fcm link option, not data message.
If the push message comes when PWA is on background, the notification is clickable and the fcm link option is open in browser, but when my PWA is on foreground, the notification was show, but when I click on that notification, nothing happens.
How could I make the notification on foregrounded PWA that work with url link in fcm options, I mean when clicking on that link, the target page must be open in browser as if the notification was handled by Firebase SDK when WebApp is on background.
Thanks for any help to solve the issue!

Flutter FCM Push Notification Not Working when app is in foreground

I am sending push notifications using Flutter's firebase_messaging package and I send them in the firebase console. When the app is in the background or when it is closed, I am receiving the notifications, however, when the app is in the foreground it is not working. Please tell me if I need to integrate Javascript to make this feature work, and please reference a resource that I can use in order to figure out how I can integrate Javascript with fcm as I haven't found a way to do this with flutter.
I figured out that someone can use the flutter local notifications plugin so that when the push notification is sent and the app is on the foreground, normally no notification would be delivered to the system tray, but using the flutter local notifications plugin, it would be possible to send a local notification when the app is on the foreground.
To Understand better.
Have a look into this table.
https://pub.dev/packages/firebase_messaging#receiving-messages
It states that when your Android or iOS Application is in foreground, OnMessage callback is called if you are sending notification payload or data payload as notification body.
You are receiving notifications when your app is in background because, when an app is in background notification is send to system tray and OS (Android or iOS) handle it for you. And your app is launched when you click on notification from system tray.
When your app is in foreground you have to catch notification payload in onMessage and handle it explicitly, you can create local notification in this case.

Ios push notification in ionic application

Push notification not receiving to my IOS device which is working fine for android. I am using Firebase to send notification for android and IOS, I have configured the google-service-info.plist file to my Firebase account and enabled push notification in Xcode before taking the build. But I am not able to receive the notification, is there any additional configuration that I required to change for IOS? Why am not getting push notification which works fine by default for android?
I am able to get device token of IOS that am using this token to trigger notification.
if you are still having this problem with ios push notification. This is how i solved it.
Login into your apple developer account and create an APNs Authentication key (.p8 file).
Then upload it to your firebase console in the cloud messaging tab.

Resources