Skip to content
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

[iOS] Local notification not show in foreground while using firebase and set setForegroundNotificationPresentationOptions(alert: false) #2474

Open
padit69 opened this issue Nov 22, 2024 · 4 comments

Comments

@padit69
Copy link

padit69 commented Nov 22, 2024

Describe the bug
On iOS, local notifications are not shown in the foreground while using Firebase when setForegroundNotificationPresentationOptions(alert: false) is configured.

To Reproduce

Integrate Firebase into the iOS project.
Configure setForegroundNotificationPresentationOptions(alert: false) in the Firebase messaging setup.
Send a local notification while the app is in the foreground.
Observe that the notification does not appear.
Expected Behavior
The local notification should appear in the foreground even when setForegroundNotificationPresentationOptions(alert: false) is configured, as it should not suppress local notifications.

Sample Code to Reproduce the Problem

FirebaseMessaging.onMessage.listen((RemoteMessage message) { // Handle the incoming notification print("Message received: ${message.notification?.title}"); // Trigger a local notification FlutterLocalNotificationsPlugin().show( 0, message.notification?.title, message.notification?.body, NotificationDetails( iOS: IOSNotificationDetails(), ), ); });

// Firebase configuration FirebaseMessaging.instance.setForegroundNotificationPresentationOptions( alert: false, badge: true, sound: true, );
Additional Context
The issue seems to occur due to the alert: false option suppressing the display of notifications in the foreground, even for local notifications triggered by the app.

@Evoswork
Copy link

notifications don't work in the release

@k1ycee
Copy link

k1ycee commented Nov 28, 2024

@Evoswork is this something that if my dev team would want to tackle internally we could or does this have something to do with iOS specifically, I am trying to make a decision on using flutter local notifications internally, I just need to be sure it won't become a bottleneck for my team.

@Levi-Lesches
Copy link
Contributor

@k1ycee @padit69 Note that this issue is not about this package, but about Firebase Cloud Messaging. If using one of their functions interferes with regular notifications, please open an issue on the firebase_messaging package, not this one. You say it should not apply to local notifications, but it's still very possible their code is affecting local notifications.

@Evoswork if you have a code sample that only works in debug and not release, please open a new issue with the code in the description, as well as the setup you've done to ensure permissions are granted, and we can probably help you there.

@AhmedHenna
Copy link

@padit69 Where you ever able to figure this out? I have the exact same issue, and I am not really sure what the problem is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants