-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Open
Labels
Needs AttentionThis issue needs maintainer attention.This issue needs maintainer attention.platform: macosIssues / PRs which are specifically for MacOS.Issues / PRs which are specifically for MacOS.plugin: messagingtype: bugSomething isn't workingSomething isn't working
Description
Is there an existing issue for this?
- I have searched the existing issues.To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Which plugins are affected?
Messaging
Which platforms are affected?
macOS
Description
This code :
FirebaseMessaging.onMessage.listen((RemoteMessage event) {
print("Message received in app : ${event.toMap()}");
});
Seems to not log anything when receiving a Push notification when the app is in the foreground on MacOS.
It works fine on Android / iOS but not on my Mac (on the same app with the same server code sending the same push notification)
Reproducing the issue
- Create a sample app or use the plugin example if it allows it
- Use this code :
Future<void> initialize() async {
NotificationSettings settings = await FirebaseMessaging.instance
.requestPermission(sound: true, carPlay: true);
if (settings.authorizationStatus == AuthorizationStatus.authorized ||
settings.authorizationStatus == AuthorizationStatus.provisional) {
_getToken();
print("Initializing the message listener...");
FirebaseMessaging.onMessage.listen((RemoteMessage event) {
print("Message received in app : ${event.toMap()}");
});
}
}
Future<void> _getToken() async {
String? apnsToken = await FirebaseMessaging.instance.getAPNSToken();
print("APNS Token : $apnsToken on ${Platform.operatingSystem}");
String token = await FirebaseMessaging.instance.getToken() ?? "";
print("FCM Token : $token on ${Platform.operatingSystem}");
}
- Send a push notification from the server (to the tokens of the MacOS target, not from FCM dashboard)
- See that you have no log "Message received in app"
Firebase Core version
3.13.0
Flutter Version
3.29.3
Relevant Log Output
Flutter dependencies
Expand Flutter dependencies
snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.
Additional context and comments
No response
Metadata
Metadata
Assignees
Labels
Needs AttentionThis issue needs maintainer attention.This issue needs maintainer attention.platform: macosIssues / PRs which are specifically for MacOS.Issues / PRs which are specifically for MacOS.plugin: messagingtype: bugSomething isn't workingSomething isn't working
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
Tom3652 commentedon May 9, 2025
I will try with the example project as soon as i can to confirm it is an issue.
Edit : i have tried but it's quite complicated to run with xcode profiles in error...
SelaseKay commentedon May 9, 2025
Hi @Tom3652, thanks for the report. I was able to reproduce this issue with the firebase_messaging example app. We'll investigate further.
SelaseKay commentedon May 12, 2025
Hi @Tom3652, after subsequent tests, I observed that
onMessage
is eventually called but after a significant delay, which seems very unusual. Could you please check if you're experiencing the same behavior on your end?Tom3652 commentedon May 12, 2025
Hi @SelaseKay , yes indeed !
I thought it was never called but i guess it's because the delay is too long and i was closing the app. But i have observed what you have described as well, we are talking about few minutes here not seconds 🙏
SelaseKay commentedon Jun 12, 2025
Hi @Tom3652, I did a bit of digging and came across this thread: https://developer.apple.com/forums/thread/740923. It seems the issue goes beyond
firebase_messaging
plugin.Tom3652 commentedon Jun 13, 2025
Hi @SelaseKay !
Yes it may be right, but how should we proceed then ?
Should i raise a firebase support ticket explaining that to see if they are aware of such situation and will confirm that this is not a firebase issue ?
It is weird because it seems it was working last year for me (my Mac was always up to date at any time so i was on Mac Os versions that should have experienced this issue)