I have flutter app. It is working for iOS. now I try to run it on macos – I have problems:
-
I added GoogleService-Info.plist to my macos/runner
-
my app uses firebase_messaging(for push notification)
final settings = await FirebaseMessaging.instance.requestPermission( announcement: true, carPlay: true, sound: true, criticalAlert: true, );
this code returns an error:
[firebase_messaging/unknown] Notifications are not allowed for this application
Found this discussion
here they advise you to manually add permissions for your application, via System Preferences > Notifications
but I don’t see my app there. i installed it via TestFlight – but that didn’t help either, the app is not listed.
how do i solve this problem? any advice – I will be grateful
also i don’t know how to configure my app properly. I found this document but there are no details (what permissions are needed and other details)
2
Answers
Firebase Messaging currently does not support macOS.
To implement push notifications for macOS, you must use the Apple Push Notification service directly. However, you are to write platform-specific code for macOS.
Firebase Messaging currently does not support macOS. The plugin is designed for Android and iOS platforms only. This is the reason you’re encountering an error when trying to run your Flutter app on macOS.
However, you can still implement native macOS notifications by using a different package. One of the options is to use the flutter_local_notifications package.
You can call the
displayNotification
function when you want to display a local notification on your macOS app.Keep in mind that this solution is for local notifications and will not work with Firebase push notifications. If you need a cross-platform solution for push notifications, you may need to explore third-party services like OneSignal or Pusher Beams, which provide support for macOS.