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

flutter_local_notifications does not display notifications on macOS sonoma 14.5 #2490

Open
AndriiReverchuk opened this issue Dec 12, 2024 · 3 comments

Comments

@AndriiReverchuk
Copy link

Describe the bug
Notifications are not displayed on macOS Sonoma 14.5 when using the flutter_local_notifications plugin. This issue occurs both in my project and when running the example provided in the repository.

To Reproduce
Steps to reproduce the behavior:
1. Clone the flutter_local_notifications example.
2. Open the example in the Flutter-supported IDE or terminal.
3. Run the example app on macOS Sonoma 14.5.
4. Trigger any notification (e.g., immediate or scheduled notification).
5. Observe that no notification is displayed.

Expected Behavior
Notifications should display correctly when triggered.

Sample Code to Reproduce the Problem
The issue can be reproduced by running the provided example app without modification.

Environment
• macOS version: Sonoma 14.5
• flutter_local_notifications version: 18.0.1
• Flutter version: 3.24.5

[✓] Flutter (Channel stable, 3.24.5, on macOS 14.5 23F79 darwin-arm64, locale uk-UA)
• Flutter version 3.24.5 on channel stable at /Users/a/.asdf/installs/flutter/3.24.5
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision dec2ee5c1f (4 weeks ago), 2024-11-13 11:13:06 -0800
• Engine revision a18df97ca5
• Dart version 3.5.4
• DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/a/Library/Android/sdk
• Platform android-34-ext8, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16B40
• CocoaPods version 1.15.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] IntelliJ IDEA Community Edition (version 2023.2.8)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 79.0.1
• Dart plugin version 232.10335.13

[✓] VS Code (version 1.95.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.102.0

[✓] Connected device (3 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.5 23F79 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 14.5 23F79 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 131.0.6778.109

[✓] Network resources
• All expected network resources are available.

Additional Context
• I followed all the steps in the documentation to configure the plugin for macOS, including setting up permissions.
• No errors or warnings appear in the logs when running the app.

@Levi-Lesches
Copy link
Contributor

Interesting, is this your first time using the package, or can you confirm that this plugin used to work on earlier versions of MacOS, Flutter, or the plugin?

Does the app even request permissions at startup? If not, try inserting some print statements here to confirm this section is running (but I don't see why it wouldn't).

Future<void> _requestPermissions() async {
if (Platform.isIOS || Platform.isMacOS) {
await flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<
IOSFlutterLocalNotificationsPlugin>()
?.requestPermissions(
alert: true,
badge: true,
sound: true,
);
await flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<
MacOSFlutterLocalNotificationsPlugin>()
?.requestPermissions(
alert: true,
badge: true,
sound: true,
);
} else if (Platform.isAndroid) {

When you press the buttons in the example, does anything get printed to the console? Any errors or warnings when showing, scheduling, or requesting permissions?

@AndriiReverchuk
Copy link
Author

I don't know if the package worked on earlier versions of macOS, Flutter, or the plugin. I followed the documentation, which states that it should work on macOS. However, notifications are not displayed, even though permissions are requested at startup.

When launching the app, the permission dialog appears as expected, and I grant all requested permissions. Despite this, no notification is shown when I trigger one (immediate or scheduled).

I tested this behavior using the example app provided in the repository without modifications. No errors or warnings are logged in the console during permission requests, or when showing or scheduling notifications.

@MaikuB
Copy link
Owner

MaikuB commented Dec 17, 2024

It's worked on older macOS versions as I would've been on Sonoma before too. Have you checked your Mac's notification settings? If you're not seeing anything then although you said it was granted, sounds more like they weren't. The notification settings for macOS can provide details on what notification permissions were granted for each individual app. I've run into similar issues where I didn't see a prompt but it's not been consistent and suspect it was a weird macOS issue given I've never had such problems with iOS

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

3 participants