You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@ This repository consists hosts the following packages
4
4
5
5
-[`flutter_local_notifications`](https://github.com/MaikuB/flutter_local_notifications/tree/master/flutter_local_notifications): code for the cross-platform facing plugin used to display local notifications within Flutter applications
6
6
-[`flutter_local_notifications_platform_interface`](https://github.com/MaikuB/flutter_local_notifications/tree/master/flutter_local_notifications_platform_interface): the code for the common platform interface
7
+
-[`flutter_local_notifications_linux`](https://github.com/MaikuB/flutter_local_notifications/tree/master/flutter_local_notifications_linux): the Linux implementation of [`flutter_local_notifications`](https://pub.dev/packages/flutter_local_notifications).
7
8
8
9
These can be found in the corresponding directories within the same name. Most developers are likely here as they are looking to use the `flutter_local_notifications` plugin. There is a readme file within each directory with more information.
@@ -47,6 +48,7 @@ A cross platform plugin for displaying local notifications.
47
48
***Android 4.1+**. Uses the [NotificationCompat APIs](https://developer.android.com/reference/androidx/core/app/NotificationCompat) so it can be run older Android devices
48
49
***iOS 8.0+**. On iOS versions older than 10, the plugin will use the UILocalNotification APIs. The [UserNotification APIs](https://developer.apple.com/documentation/usernotifications) (aka the User Notifications Framework) is used on iOS 10 or newer.
49
50
***macOS 10.11+**. On macOS versions older than 10.14, the plugin will use the [NSUserNotification APIs](https://developer.apple.com/documentation/foundation/nsusernotification). The [UserNotification APIs](https://developer.apple.com/documentation/usernotifications) (aka the User Notifications Framework) is used on macOS 10.14 or newer.
51
+
***Linux**. Uses the [Desktop Notifications Specification](https://developer.gnome.org/notification-spec/).
50
52
51
53
## ✨ Features
52
54
@@ -83,6 +85,14 @@ A cross platform plugin for displaying local notifications.
83
85
*[Android] Full-screen intent notifications
84
86
*[iOS (all supported versions) & macOS 10.14+] Request notification permissions and customise the permissions being requested around displaying notifications
85
87
*[iOS 10 or newer and macOS 10.14 or newer] Display notifications with attachments
88
+
*[Linux] Ability to to use themed/Flutter Assets icons and sound
89
+
*[Linux] Ability to to set the category
90
+
*[Linux] Configuring the urgency
91
+
*[Linux] Configuring the timeout (depends on system implementation)
92
+
*[Linux] Ability to set custom notification location (depends on system implementation)
93
+
*[Linux] Ability to set custom hints
94
+
*[Linux] Ability to suppress sound
95
+
*[Linux] Resident and transient notifications
86
96
87
97
## ⚠ Caveats and limitations
88
98
The cross-platform facing API exposed by the `FlutterLocalNotificationsPlugin` class doesn't expose platform-specific methods as its goal is to provide an abstraction for all platforms. As such, platform-specific configuration is passed in as data. There are platform-specific implementations of the plugin that can be obtained by calling the [`resolvePlatformSpecificImplementation`](https://pub.dev/documentation/flutter_local_notifications/latest/flutter_local_notifications/FlutterLocalNotificationsPlugin/resolvePlatformSpecificImplementation.html). An example of using this is provided in the section on requesting permissions on iOS. In spite of this, there may still be gaps that don't cover your use case and don't make sense to add as they don't fit with the plugin's architecture or goals. Developers can fork or maintain their own code for showing notifications in these situations.
@@ -114,13 +124,22 @@ Due to limitations currently within the macOS Flutter engine, `getNotificationAp
114
124
115
125
The `schedule`, `showDailyAtTime` and `showWeeklyAtDayAndTime` methods that were implemented before macOS support was added and have been marked as deprecated aren't implemented on macOS.
116
126
127
+
##### Linux limitations
128
+
129
+
Capabilities depend on the system notification server implementation, therefore, not all features listed in `LinuxNotificationDetails` may be supported. One of the ways to check some capabilities is to call the `LinuxFlutterLocalNotificationsPlugin.getCapabilities()` method.
130
+
131
+
Scheduled/pending notifications is currently not supported due to the lack of a scheduler API.
132
+
133
+
To respond to notification after the application is terminated, your application should be registered as DBus activatable (see [DBusApplicationLaunching](https://wiki.gnome.org/HowDoI/DBusApplicationLaunching) for more information), and register action before activating the application. This is difficult to do in a plugin because plugins instantiate during application activation, so `getNotificationAppLaunchDetails` can't be implemented without changing the main user application.
| Linux | <imgsrc="https://github.com/MaikuB/flutter_local_notifications/raw/master/images/gnome_linux_notification.png"> <imgsrc="https://github.com/MaikuB/flutter_local_notifications/raw/master/images/kde_linux_notification.png"> |
124
143
125
144
126
145
## 👏 Acknowledgements
@@ -199,7 +218,7 @@ By design, iOS applications *do not* display notifications while the app is in t
199
218
200
219
For iOS 10+, use the presentation options to control the behaviour for when a notification is triggered while the app is in the foreground. The default settings of the plugin will configure these such that a notification will be displayed when the app is in the foreground.
201
220
202
-
For older versions of iOS, you need to handle the callback as part of specifying the method that should be fired to the `onDidReceiveLocalNotification` argument when creating an instance `IOSInitializationSettings` object that is passed to the function for initializing the plugin.
221
+
For older versions of iOS, you need to handle the callback as part of specifying the method that should be fired to the `onDidReceiveLocalNotification` argument when creating an instance `IOSInitializationSettings` object that is passed to the function for initializing the plugin.
203
222
204
223
Here is an example:
205
224
@@ -259,7 +278,7 @@ The [`example`](https://github.com/MaikuB/flutter_local_notifications/tree/maste
259
278
260
279
### API reference
261
280
262
-
Checkout the lovely [API documentation](https://pub.dev/documentation/flutter_local_notifications/latest/flutter_local_notifications/flutter_local_notifications-library.html) generated by pub.
281
+
Checkout the lovely [API documentation](https://pub.dev/documentation/flutter_local_notifications/latest/flutter_local_notifications/flutter_local_notifications-library.html) generated by pub.
263
282
264
283
265
284
## Initialisation
@@ -412,7 +431,7 @@ tz.initializeTimeZones();
412
431
Once the time zone database has been initialised, developers may optionally want to set a default local location/time zone
The `timezone` package doesn't provide a way to obtain the current time zone on the device so developers will need to use [platform channels](https://flutter.dev/docs/development/platform-integration/platform-channels) or use other packages that may be able to provide the information. The example app uses the [`flutter_native_timezone`](https://pub.dev/packages/flutter_native_timezone) plugin.
As the plugin class is not static, it is possible to mock and verify its behaviour when writing tests as part of your application.
591
-
Check the source code for a sample test suite that has been kindly implemented (_test/flutter_local_notifications_test.dart_) that demonstrates how this can be done.
609
+
As the plugin class is not static, it is possible to mock and verify its behaviour when writing tests as part of your application.
610
+
Check the source code for a sample test suite that has been kindly implemented (_test/flutter_local_notifications_test.dart_) that demonstrates how this can be done.
592
611
593
-
If you decide to use the plugin class directly as part of your tests, the methods will be mostly no-op and methods that return data will return default values.
612
+
If you decide to use the plugin class directly as part of your tests, the methods will be mostly no-op and methods that return data will return default values.
594
613
595
-
Part of this is because the plugin detects if you're running on a supported plugin to determine which platform implementation of the plugin should be used. If the platform isn't supported, it will default to the aforementioned behaviour to reduce friction when writing tests. If this not desired then consider using mocks.
614
+
Part of this is because the plugin detects if you're running on a supported plugin to determine which platform implementation of the plugin should be used. If the platform isn't supported, it will default to the aforementioned behaviour to reduce friction when writing tests. If this not desired then consider using mocks.
596
615
597
616
If a platform-specific implementation of the plugin is required for your tests, a [named constructor](https://pub.dev/documentation/flutter_local_notifications/latest/flutter_local_notifications/FlutterLocalNotificationsPlugin/FlutterLocalNotificationsPlugin.private.html) is available that allows you to specify the platform required e.g. a [`FakePlatform`](https://api.flutter.dev/flutter/package-platform_platform/FakePlatform-class.html).
0 commit comments