Describe the bug
Just performing a simple firebase messaging demo with push notification following README file in firebase_messaging pub package.
I am getting push notification data in onmessage method when app is in foreground. But, If you send push notification and your app is in background then notification will be added to the system notification tray. when you click on it and it will redirect you to your app and you will not get any data in your onmessge or onlaunch or onresume method. I am getting null data trying all feasible solutions from two days.
Can you explain me what can be the solution for my problem ?
Also, can anyone suggest any solution for FCM notification retrieval while app is not running or app is killed ?
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I want to fetch fcm notification when my app is in background. when i click on that notification that should be redirect me to the app (Till this i am fine) and i should get fcm data either in onResume or onMessage or onLaunch method (this is the issue in my case).
Additional context
Suggest any solution or fixes to achieve the desired goal
The same, notifications not show.
same issue here but only on iOS
same issue here but only on iOS
Did this code work in android ?
same issue here but only on iOS
Did this code work in android ?
Not working for me on android.
I'm going to build a fresh project today and report back.
Yep, for me the same, not working on android and ios
Experiencing the same issue. But we're still receiving notifications when the app is dismissed.
Android, however, is working fine.
I'm going to build a fresh project today and report back.
@markuspaschi any updates? how was your fresh project?
interstingly does not work for my iOS but works on android
For iOS, i do not even get a notification in the tray anymore, nor on frontscreen(locked).
interstingly does not work for my iOS but works on android
For iOS, i do not even get a notification in the tray anymore, nor on frontscreen(locked).
Did your android app notification works when your app is in background ?
Also, can you please tell me when you click on your notification in tray and if you click on the notification then does your onresume, onmessage or onlaunch method gets any data if your app is running in background.
Please try 4-5 times and update me about the fcm behaviour.
Thanks.
Works perfectly for me on android.
If onResume and onLaunch is not triggered you need to add "click_action" to your data payload and manifest. Check readme for that.
Background handling of notifications is only working for data messages. (readme last line).
Took me a while as well to set up everything accordingly.
everything
But, I am not able to fetch simple notification data or data payload while app is terminated.
I am able to find notification in tray but, when i click on the notification i am not able to find any data in onresume, onlaunch or onmessage method.
Can you please show me a way how can i get either notification or data payload if available in flutter methods.
Thanks.
I can't get anything to drop into the system tray on iOS. Works fine on Android. No idea why. Worked on it for an entire week, zero progress.
Noticed that onMessage is fired when app returns to foreground, even though nothing is tapped (because nothing is in the system tray).
Using Firebase Admin SDK in Asp.Net Core to send messages and the contents of the Aps never shows up in the app at all. Ever.
ROOKIE MISTAKE 馃悙
I'm posting this because, as impossible as it seems, I could see it happening to someone else.
I acquired two used phones, a Galaxy S7 and an iPhone 5s because I wanted older models for testing. I went to T-Mobile and they happily added both to limited plans.
I got to my desk, turned them on and plugged one into my mac Mini and the other into my PC. I was having null device problems on the mac and someone mentioned that WiFi "enabled" caused problems with testing on the mac, so I disabled WiFi on the iPhone. Never thought to do it on the S7.
I am using Firebase Admin SDK to push messages. All Android messages arrived fine in all aspects. The notification property of the message arrived on the iPhone, but that's all I ever got. And nothing ever appeared in the system tray, app terminated, background or whatever. And interestingly, the payload was a notification message.
At this point, I don't have any of the background code in the new 5.1.6 version even installed. I was just trying to get it working.
Spent a week. Finally lost it and went for a walk. Coincidentally had the iPhone on me and noticed that _despite showing 4G LTE in the banner_ Spotify wouldn't play. That's when I realized that I didn't have any data service, or at least it wasn't working.
Turns out, the iPhone and the S7 were never provisioned for data services. Clerk at the store just muffed it. But the S7 was working because WiFi was enabled.
Sorted it at the store today and the, about 4 hours later, magically, I'm getting all the iOS push notifications that I'm supposed to. And, interestingly, these are coming through in the aps property.
Hope this helps someone.
Hey all 馃憢
As part of our roadmap (#2582) we've just shipped a complete rework of the firebase_messaging plugin that aims to solve this and many other issues.
If you can, please try out the dev release (see the migration guide for upgrading and for changes) and if you have any feedback then join in the discussion here.
Given the scope of the rework I'm going to go ahead and close this issue in favor of trying out the latest plugin. I'd also recommend checking out the new documentation to ensure you integrate correctly (common cause of issues is an incomplete/incorrect integration).
Thanks everyone 馃