-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloud Messaging: flutter firebase background notification not working for iOS #16878
Comments
Duplicate of #16853 |
has this error been resolved? |
Hi @MuhammedEminK, apologies for linking the wrong issue earlier. This issue was raised recently and seems to have been resolved. I'm unable to reproduce this issue on my end with the current |
any update ? |
I am also facing same issue. I am also not able to receive notifications on iOS. |
Many people are saying that this issue can't be resolved, but it's been over two months and it's still not fixed. I wonder what the Flutter team is doing about it. |
Hey @MuhammedEminK. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically. If you have more information that will help us get to the bottom of this, just add a comment! |
I just tried it on iPhone 11 Pro, iOS version 18.1.1, it runs normally in debug mode, but doesn't work in release mode |
Hey, I am also facing the same issue, background notification cant be accessed, means the notification is coming but I can't handle that notification using Firebase background handler |
Hi all, how are you confirming that the background handler is not being triggered? I encountered a similar issue while testing in release mode on iOS. Initially, I thought the handler wasn't working because my print statements weren't being executed. After further investigation, I discovered this is a known Flutter issue. It seems that Let me know if this helps. |
what kind of information |
Hi @MuhammedEminK, could you confirm if this applies to your case? |
@pragma('vm:entry-point')
Future<void> firebaseMessagingBackgroundHandler(RemoteMessage message) async {
print("Handling a background message: ${message.messageId}");
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
String receiverId = message.data['receiverId'];
print("Receiver ID: $receiverId");
// Update home widget
await SnapApi().updateHomeWidget(receiverId: receiverId);
WidgetsBinding.instance.addPostFrameCallback((_) async {
print("Creating notification in background");
await AwesomeNotifications().createNotification(
content: NotificationContent(
id: DateTime.now().millisecondsSinceEpoch.remainder(100000),
channelKey: 'Mesaj',
title: "Deneme",
body: "Deneme",
// Add any additional data from message.data
),
);
});
} I ran it on iOS 15.8 in version mode and saw the print output in the Xcode console and got the 'Deneme Deneme' notification, but it didn't work in the emulator. I couldn't try it on iOS 17, 18 in realse mode |
Which emulator did you use for testing? |
I used iPhone 15 iOS 17.0, iPhone 15 iOS 17.5, iPhone 16, iPhone 16 Plus, and iPhone 16 Pro iOS 18.1 for testing. |
I've just tried on a real device in release mode, background notifications work. |
Is there an existing issue for this?
Which plugins are affected?
Messaging
Which platforms are affected?
iOS
Description
I’m implementing Firebase Cloud Messaging (FCM) in my Flutter app to handle push notifications. However, I’ve encountered the following issue:
I have looked all of the other questions and answers but I couldn't solve my problem even I try everything
Reproducing the issue
main.dart
AppDelegate.swift
data
info.plist
I try
but not work
Firebase Core version
3.8.0
Flutter Version
3.24.5
Relevant Log Output
No response
Flutter dependencies
Expand
Flutter dependencies
snippetAdditional context and comments
How can I fix it?
The text was updated successfully, but these errors were encountered: