A Flutter plugin for displaying local notifications on Android, iOS and macOS

Overview

Flutter Local Notifications plugin

This repository consists hosts the following packages

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.

Issues

If you run into bugs, please raise them on the GitHub repository. Please do not email them to me as GitHub is the appropriate place for them and allows for members of the community to answer questions, particularly if I miss the email. It would also be much appreciated if they could be limited to actual bugs or feature requests. If you're looking at how you could use the plugin to do a particular kind of notification, check the example app provides detailed code samples for each supported feature. Also try to check the README first in case you have missed something e.g. platform-specific setup.

Contributions

The guidelines around submitting pull requests can be found here

Comments
  • WIP: [flutter_local_notifications ] Notification actions for iOS, macOS, Android

    WIP: [flutter_local_notifications ] Notification actions for iOS, macOS, Android

    This PR addresses #17 - and includes a very basic implementation for iOS & Android.

    A click on the notification will launch (if not already running) a separate Flutter engine, which initializes a callback dispatcher. The dispatcher function then sets up platform communication for other plugins and starts listening to a event channel for existing or additional notification click events.

    Screenshots

    Android:

    Simple actions:

    screen

    Text input actions to collect user entered text:

    screen

    iOS:

    Simulator Screen Shot - iPod touch (7th generation) - 2020-11-01 at 09 23 40

    macOS:

    Simple actions:

    Screen Shot 2021-12-29 at 20 50 59

    Text input actions to collect user entered text:

    Screen Shot 2022-01-02 at 22 28 54

    The PR is in early stage to gather feedback on the basic use case by others.

    Feedback requested

    Please support this PR by testing it in your own App and comment with missing features / use cases.

    To use it, add the following to your pubspec.yaml file:

    dependency_overrides:
      flutter_local_notifications:
        git:
          url: https://github.com/ened/flutter_local_notifications.git
          path: flutter_local_notifications
          ref: 17-notification-actions
      flutter_local_notifications_platform_interface:
        git:
          url: https://github.com/ened/flutter_local_notifications.git
          path: flutter_local_notifications_platform_interface
          ref: 17-notification-actions
    

    The documentation is still very incomplete, therefore please refer to the example project of this branch.

    Open tasks

    • [x] Text input & predefined action (Android) support
    • [x] Android: Notification Actions text color: https://stackoverflow.com/questions/41073294/how-to-change-notification-action-text-color-in-android-n
    • [ ] Documentation
    • [ ] Test coverage
    • [x] macOS support
    • [x] metadata/payload accessible in action handler
    • [x] autoCancel property for android notification action handler that dismisses the notification (feature parity with iOS)
    notification actions 
    opened by ened 98
  • 'showDailyAtTime()' dose not  work as expected

    'showDailyAtTime()' dose not work as expected

    Describe the bug The follwoing phenomena occur on android phones and I am not sure whether they would occur on iOS phones or not.

    1. 'showDailyAtTime()' dose not work as expected, which should have pushed the notification at a specific time but failed;
    2. Two apps invoking this plugin and running on a same Android phone seems tending to push notifications at the same time using 'showDailyAtTime()';
    3. Very often, when pushing notifications, more than 1 notifications are pushed at the same time with 'showDailyAtTime()';

    These issues have nothing to do with the phone model, as I have tried on different phones. In addition, I do not know why the built-in example code of "flutter_local_notifications" cannot work, as every time I lauched the App, it crashes and prompted "flutter_local_notifications_example 已停止。"

    To Reproduce

    This plugin used to work normally, but after I did some things like: upgrading the flutter SDK and tweaking the codes in gradle file to suite the new SDK and updated plugins, these bugs appeared. I tried to rewind everything to somewhere the code can work normally, which includes getting back the old flutter SDK version and the gitted code, but all failed.

    What do I need If possible, please simply give me some clues why these phenomena happens. Thanks so much for your help.

    opened by TristanWYL 46
  •  Unhandled Exception: MissingPluginException(No implementation found for method initialize on channel dexterous.com/flutter/local_notifications)

    Unhandled Exception: MissingPluginException(No implementation found for method initialize on channel dexterous.com/flutter/local_notifications)

    I'm trying to fire a notification when the background location callback returns. But this leads into the following exception: Unhandled Exception: MissingPluginException(No implementation found for method initialize on channel dexterous.com/flutter/local_notifications)

    I know, that there was an issue with the same problem before, but there was no solution provided.

    opened by p493z3r0 43
  • Possible security exploited finded

    Possible security exploited finded

    While i was fininshing my fork to implement a basic Action Button functionality, i finded a high possible security issue for every app using the flutter_local_notification.

    Causes:

    The payload returned between the native code and Flutter method callback is plain text. That means the app above should extract that plain text value to process it. Taking note that some of key informations, such notification id, are lost in MethodCall transition process, the actual scenario estimulate the app developer to put complex references over plain text payload do caputure it after the user taps on notification.

    If that app allows another users with low priviledge to send notifications to someone, now they have access to send malicious strings through notifications that could reach internal process steps and allow code or parameters injection to manipulate the app.

    Example

    Consider a App using a json encoded string over payload to recovery its references after the user tap a notification. A malicious user could inject another json encoded string (with manipulated parameters or extra fields) through the body message or even on a input text response, such as Android´s RemoteInput. After the tap event, the malicious code could be processed and interpreted, allowing the user to reach unauthorized pages or functionalities. such as expired promotion codes, privated messages, etc.

    Solution

    The solution is to return over MethodCall flutter listener an object and not a plain text. As the layers between android and ios cannot communicate with dart files passing memory object ( because they are made from different technologies ) we gonna pass the object encoded, containing the payload string escaped, and decode the object to memory on flutters ´s side, without need to check the payload, considering that every user input contains unsafe information.

    Under the object used to transfer the information, we gonna put the others notification information, such notification_id, etc.

    The difference bettween the plugin doing that oposes the app is the pluggin extends to native code, where is completely possible to distinguish parameters from payload without need to process and interpret the payload content.

    But the obvious consequence is the new returned payload is totaly different from the old one. The new method is naturaly incompatible with App who readed plain text from the olders versions.

    So i propose to create a copy of onSelectNotification, on called onReceiveNotification, passing a object to the receiver event, and also to mark the old onSelectNotification as deprecated and unsecure. That way the new notification plugin will not becom totaly incompatible with those apps, the developers will be warned about the danger and will keep receiving another updates until they change their codes.

    So, what you guys think about that? there is a better way to do those changes?

    opened by rafaelsetragni 31
  • onSelectNotification code not being called when a notification is tapped and the application is not running

    onSelectNotification code not being called when a notification is tapped and the application is not running

    It works perfectly while the app is running, but when the application is closed the function is not called.

    The code can be found here https://github.com/GroovinChip/CallManager/blob/dev/lib/HomeScreen.dart

    I can't provide a stacktrace because the issue only occurs while the app is not running.

    If you'd be so kind as to provide quick assistance, I'd really appreciate it - I had to pull a crucial feature from production due to this bug.

    Thanks!

    opened by GroovinChip 28
  • [flutter_local_notifications] Linux support

    [flutter_local_notifications] Linux support

    The Desktop Notifications Specification is used as an implementation.

    I have separated the Linux plugin package from the main plugin package. This is necessary to correctly implement the Dart version of the plugin without using native code. For example, dbus package is used to communicate with the Desktop Notifications Specification and a few more auxiliary packages that allow to access native methods/environment. Once this pull request is merged in the new version of the plugin, change the relative path to the package in pubspec.yaml: https://github.com/proninyaroslav/flutter_local_notifications/blob/ddc57043dcb6d68bd94d48b9fc601753ff4f899c/flutter_local_notifications/pubspec.yaml#L15

    Implemented features:

    • initialize() method and LinuxInitializationSettings.
    • show() method and LinuxNotificationDetails.
    • cancel(), cancelAll() methods.
    • getCapabilities() method, which returns some of the capabilities implemented by the system notification service. Please see Desktop Notifications Specification#Backwards Compatibility.
    • getSystemIdMap() method, that returns a Map with the specified notification id as the key and the id, assigned by the system, as the value. Because by specification, the system itself generates notification id, an [app id: system id] map is used, which is cached within the user session.

    Non-implemented features:

    • Notification actions. It's possible to implement them, but I didn't do this, because there is still no established/official API in the plugin. For example, one of the possible implementations that is not yet upstream https://github.com/MaikuB/flutter_local_notifications/pull/880.
    • Scheduled/pending notifications. As mentioned here https://github.com/MaikuB/flutter_local_notifications/pull/1208#issuecomment-869552295, currently, the scheduler implementation is fraught with difficulties, because Linux doesn't have an appropriate API. As a possible option, we can consider interacting with systemd (similar to launchd on macOS) via D-Bus API of systemd (as done in the Desktop Notifications Specification). This will allow the scheduler to run as a system service. I haven't yet investigated how realistic it's to implement it in the plugin without changes from the application developer/user side.
    • getNotificationAppLaunchDetails(). To respond to notification after the application is terminated, the application should be registered as DBus activatable (see 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.

    Testing the Desktop Notifications Specification in real-world conditions is difficult, because different Linux distributions and DE may or may not implement some of the specification things. For example, on GNOME, you can't set a timeout, custom sound, or screen location. Therefore, I wrote extensive tests that validate the request setmantics and format required by the Desktop Notifications Specification. For real world testing of notifications, I would recommend using different DEs such as GNOME (e.g Ubuntu or Fedora), KDE (e.g Kubuntu), XFCE (e.g Xubuntu), MATE (e.g Ubuntu MATE), etc.

    I also ask you to pay attention to these two methods: https://github.com/proninyaroslav/flutter_local_notifications/blob/ddc57043dcb6d68bd94d48b9fc601753ff4f899c/flutter_local_notifications_linux/lib/src/typedefs.dart#L5 https://github.com/proninyaroslav/flutter_local_notifications/blob/ddc57043dcb6d68bd94d48b9fc601753ff4f899c/flutter_local_notifications_linux/lib/src/helpers.dart#L9 Because I split the Linux plugin version into a separate package, I had to copy these two methods for the plugin to work correctly. It might be worth leaving that as it is. Although you might consider moving the common methods into a separate package.

    gnome_linux_notification kde_linux_notification 2021-07-11 11-11-08

    opened by proninyaroslav 26
  • zonedSchedule not working on my phone

    zonedSchedule not working on my phone

    Hi,

    I used to zonedSchedule to send notifications at the specific time, it works fine on the emulator but when I try different real devices and schedule notification at the specific time, there is no notification, crash, or error.

    Here is my code:

    tz.initializeTimeZones();
    
          var now = DateTime.now();
    
          var time2 = tz.TZDateTime(
            tz.local,
            now.year,
            now.month,
            now.day,
            _selectedTime.hour,
            _selectedTime.minute,
          );
    
          int notificationID = widget.newActivity.id;
    
          _flutterLocalNotificationsPlugin
              .zonedSchedule(
                  notificationID, title, body, time2, generalNotificationDetails,
                  uiLocalNotificationDateInterpretation:
                      UILocalNotificationDateInterpretation.absoluteTime,
                  androidAllowWhileIdle: true)
              .then((value) {
            _setAlarm(widget.newActivity.id, _formattedTime);
            setState(() {
              _hasNotification = true;
            });
            print("notification created!");
          });
    
    opened by draxex 23
  • On restart, all previous notifications reschedule themselves despite being dismissed before.

    On restart, all previous notifications reschedule themselves despite being dismissed before.

    Hi MaikuB, I seem to be encountering an issue where when notifications are displayed and manually dismissed, upon restarting the device, when the phone boots up, all previous notifications that occurred while the phone was turned on suddenly all come in all at once. It's as if they were never really dismissed.

    If I set a notification to fire at a specific time, it, fires, then I manually call "CancelNotification" on that single notification with that ID, even though this successfully removes the notification and dismisses it from the status bar, when I restart the phone, it reappears as if it were never canceled.

    If I use "CancelAllNotifications" however, it does truly "cancel" it and previously dismissed notifications don't reappear upon restart, but obviously, I can continuously call "CancelAllNotifications" for a single notification because it will remove all the other unrelated notifications iv'e set up as well.

    Any idea about this?

    opened by SuitMonkeyB 23
  • Use try/catch

    Use try/catch

    Describe the bug I have an app with 3 million downloads and flutter_local_notifications are the #1 issues on Crashlytics (not because of this plugin, but because Android itself sucks).

    What I do is to fill the plugin Java code with try/catches to ignore errors so the app won't crash (the users will not receive notifications, but at least they can use the app).

    Here are some logs (those are just examples: almost every point in this plugin crashes, including boot_received): image

    Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver: java.lang.NullPointerException: Attempt to write to field 'long android.app.Notification.when' on a null object reference
           at android.app.ActivityThread.handleReceiver(ActivityThread.java:3369)
           at android.app.ActivityThread.-wrap20(ActivityThread.java)
           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1726)
           at android.os.Handler.dispatchMessage(Handler.java:102)
           at android.os.Looper.loop(Looper.java:154)
           at android.app.ActivityThread.main(ActivityThread.java:6776)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
    
    Caused by java.lang.NullPointerException: Attempt to write to field 'long android.app.Notification.when' on a null object reference
           at com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver.onReceive(ScheduledNotificationReceiver.java:32)
           at android.app.ActivityThread.handleReceiver(ActivityThread.java:3362)
           at android.app.ActivityThread.-wrap20(ActivityThread.java)
           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1726)
           at android.os.Handler.dispatchMessage(Handler.java:102)
           at android.os.Looper.loop(Looper.java:154)
           at android.app.ActivityThread.main(ActivityThread.java:6776)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
    

    image

    Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
           at android.app.ActivityThread.handleReceiver(ActivityThread.java:3658)
           at android.app.ActivityThread.access$1400(ActivityThread.java:245)
           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1839)
           at android.os.Handler.dispatchMessage(Handler.java:106)
           at android.os.Looper.loop(Looper.java:216)
           at android.app.ActivityThread.main(ActivityThread.java:7258)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
    
    Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
           at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.setupNotificationChannel(FlutterLocalNotificationsPlugin.java:634)
           at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:130)
           at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:688)
           at com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver.onReceive(ScheduledNotificationReceiver.java:45)
           at android.app.ActivityThread.handleReceiver(ActivityThread.java:3649)
           at android.app.ActivityThread.access$1400(ActivityThread.java:245)
           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1839)
           at android.os.Handler.dispatchMessage(Handler.java:106)
           at android.os.Looper.loop(Looper.java:216)
           at android.app.ActivityThread.main(ActivityThread.java:7258)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
    

    image

    Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.dexterous.flutterlocalnotifications.models.NotificationDetails.channelId' on a null object reference
           at android.app.ActivityThread.handleReceiver(ActivityThread.java:4012)
           at android.app.ActivityThread.access$1500(ActivityThread.java:232)
           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2025)
           at android.os.Handler.dispatchMessage(Handler.java:107)
           at android.os.Looper.loop(Looper.java:241)
           at android.app.ActivityThread.main(ActivityThread.java:7617)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
    
    Caused by java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.dexterous.flutterlocalnotifications.models.NotificationDetails.channelId' on a null object reference
           at com.dexterous.flutterlocalnotifications.models.NotificationChannelDetails.fromNotificationDetails(NotificationChannelDetails.java:74)
           at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:138)
           at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:803)
           at com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver.onReceive(ScheduledNotificationReceiver.java:56)
           at android.app.ActivityThread.handleReceiver(ActivityThread.java:4003)
           at android.app.ActivityThread.access$1500(ActivityThread.java:232)
           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2025)
           at android.os.Handler.dispatchMessage(Handler.java:107)
           at android.os.Looper.loop(Looper.java:241)
           at android.app.ActivityThread.main(ActivityThread.java:7617)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
    
    opened by JCKodel 22
  • [Feature request] Improve API for setting intervals

    [Feature request] Improve API for setting intervals

    I previously used showDailyAtTime to set a daily reminder - that was a pretty nice API.

    I saw it was deprecated, and now to add intervals was pretty rough..

    • First you have to get a time zone, by initializing a database and calling either a platform call or getting a third party package.
    • Then you have to be sure the TZDateTime, given the timezone location, has a date in the future ( or it will crash ), even though i'm only interested in the hour and seconds of the day.
    • Then you have to pick the DateTimeComponents which only have two items.

    This was a lot of work to get up and running. I think this could be improved upon.

    opened by erf 21
  • Scheduled Local Notifications are delayed/ don't show on Android 8.1

    Scheduled Local Notifications are delayed/ don't show on Android 8.1

    Hi,

    I have installed the local notifications plugin and set it up according to the instructions and they work as they should on lower android versions as it should.

    However, on Android 8.1.0, the notifications are either delayed really badly or they don't show up at all. I have registered the BroadcastReceiver class in AndroidManifest.xml, but still there is this problem. I am scheduling multiple notifications and they are all having different ID's as I saw in a different issue that this is a problem.

    Please advise. Thank you

    [√] Flutter (Channel beta, v1.0.0, on Microsoft Windows [Version 6.3.9600], locale en-US) • Flutter version 1.0.0 • Framework revision 5391447fae (8 weeks ago), 2018-11-29 19:41:26 -0800 • Engine revision 7375a0f414 • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

    [√] Android toolchain - develop for Android devices (Android SDK 28.0.3) • Platform android-28, build-tools 28.0.3 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06) • All Android licenses accepted.

    [√] Android Studio (version 3.2) • Flutter plugin version 31.3.1 • Dart plugin version 181.5656 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

    [√] VS Code, 32-bit edition (version 1.29.1) • Flutter extension version 2.21.1

    opened by alexandranb 21
  • cannot find 'UNNotificationInterruptionLevel' in scope

    cannot find 'UNNotificationInterruptionLevel' in scope

    Describe the bug The main.dart example on pub.dev does not works with these error:

    Command MergeSwiftModule failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    /Volumes/LAVORI CRUCIAL/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_local_notifications-11.0.1/macos/Classes/FlutterLocalNotificationsPlugin.swift:512:45: error: cannot find 'UNNotificationInterruptionLevel' in scope
                    content.interruptionLevel = UNNotificationInterruptionLevel.init(rawValue: rawInterruptionLevel)!
                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ** BUILD FAILED **
    

    To Reproduce

    1. flutter create myproject
    2. copy main.dart from "example page" on pub.dev
    3. replace lib/main.dart with the code gets from example page.
    4. flutter pub add device_info_plus flutter_local_notifications flutter_native_timezone path_provider timezone
    5. exec 'flutter run' and choice macos

    My system Flutter 3.0.5 • channel stable • https://github.com/flutter/flutter.git Framework • revision f1875d570e (3 months ago) • 2022-07-13 11:24:16 -0700 Engine • revision e85ea0e79c Tools • Dart 2.17.6 • DevTools 2.12.2 osx 11.6.1 xcode Version 12.5.1

    opened by ziobudda 3
  • Actions cause the crash of the entire app

    Actions cause the crash of the entire app

    Describe the bug When I show a notification with actions and I try to press one of them the application crash, the warning are referencing to the unability of the system to reach a receiver

    To Reproduce Just show a notification with action and try to press one of the action button, it does not depend whether the application is running or not, it also does not depend on the callback function referenced on onDidReceiveNotificationResponse args.

    bug.txt

    opened by EnricoTirri 1
  • styleInformation not working

    styleInformation not working

    Describe the bug styleInformation not working , I tried with BigTextStyleInformation and default one, it doesn't change a bit.

    Expected behavior BigTextStyleInformation should show big text

    Sample code to reproduce the problem It doesn't matter which style I put , It always looks same.

    InboxStyleInformation inboxStyleInformation = InboxStyleInformation(
            lines,
            contentTitle: "title",
            summaryText: "${activeNotifications.length - 1} messages",
          );
          BigTextStyleInformation style =
              const BigTextStyleInformation("messages from");
          AndroidNotificationDetails groupNotificationDetails =
              AndroidNotificationDetails(
            chatChannel.id,
            chatChannel.name,
            channelDescription: chatChannel.description,
            styleInformation: const DefaultStyleInformation(true, true),
            setAsGroupSummary: true,
            groupKey: chatChannel.id,
          );
    
    opened by abhay-s-rawat 1
  • Crash with class java.time.ZoneId not found

    Crash with class java.time.ZoneId not found

    After plugin upgrade up to 11.0.0 found this new very often crash type on firebase reports.

    Fatal Exception: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/time/ZoneId;
           at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.getNextFireDateMatchingDateTimeComponents(FlutterLocalNotificationsPlugin.java:1196)
           at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.zonedSchedule(FlutterLocalNotificationsPlugin.java:1454)
           at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:1308)
           at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
           at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
           at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0(DartMessenger.java:319)
           at io.flutter.embedding.engine.dart.DartMessenger.$r8$lambda$TsixYUB5E6FpKhMtCSQVHKE89gQ(DartMessenger.java)
           at io.flutter.embedding.engine.dart.DartMessenger$$InternalSyntheticLambda$0$5dd8b6f7959f08bc8717eff7469e77e06ef5aed51cc0cee17f1e13794798223f$0.run(DartMessenger.java)
           at android.os.Handler.handleCallback(Handler.java:761)
           at android.os.Handler.dispatchMessage(Handler.java:98)
           at android.os.Looper.loop(Looper.java:156)
           at android.app.ActivityThread.main(ActivityThread.java:6523)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
    
    opened by softkot 3
  • Android App crashes on startup when desugaring is enabled

    Android App crashes on startup when desugaring is enabled

    Android App crashes on startup when desugaring is enabled. If desugaring is disabled, app launches correctly.

    To Reproduce

    1. Follow documentation instructions
    2. Launch on API 33 emulator

    Expected behavior

    Expecting the to start regularly

    Sample code to reproduce the problem

    My gradle file is like this:

    ...
        defaultConfig {
            minSdkVersion 23
            targetSdkVersion 33
            versionCode flutterVersionCode.toInteger()
            versionName flutterVersionName
        }
    
    ...
    
        compileOptions {
            coreLibraryDesugaringEnabled true
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    
    ...
    
    dependencies {
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
    }
    

    The app crashes on startup with this in console:

    E/AndroidRuntime(14287): java.lang.NoSuchMethodError: No interface method addWindowLayoutInfoListener(Landroid/app/Activity;Lj$/util/function/Consumer;)V in class Landroidx/window/extensions/layout/WindowLayoutComponent; or its super classes (declaration of 'androidx.window.extensions.layout.WindowLayoutComponent' appears in /system_ext/framework/androidx.window.extensions.jar)
    E/AndroidRuntime(14287): 	at androidx.window.layout.ExtensionWindowLayoutInfoBackend.registerLayoutChangeCallback(ExtensionWindowLayoutInfoBackend.kt:68)
    E/AndroidRuntime(14287): 	at androidx.window.layout.WindowInfoTrackerImpl$windowLayoutInfo$1.invokeSuspend(WindowInfoTrackerImpl.kt:52)
    E/AndroidRuntime(14287): 	at androidx.window.layout.WindowInfoTrackerImpl$windowLayoutInfo$1.invoke(Unknown Source:8)
    E/AndroidRuntime(14287): 	at androidx.window.layout.WindowInfoTrackerImpl$windowLayoutInfo$1.invoke(Unknown Source:4)
    E/AndroidRuntime(14287): 	at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
    E/AndroidRuntime(14287): 	at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:227)
    E/AndroidRuntime(14287): 	at androidx.window.java.layout.WindowInfoTrackerCallbackAdapter$addListener$1$1.invokeSuspend(WindowInfoTrackerCallbackAdapter.kt:96)
    E/AndroidRuntime(14287): 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    E/AndroidRuntime(14287): 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    E/AndroidRuntime(14287): 	at android.os.Handler.handleCallback(Handler.java:942)
    E/AndroidRuntime(14287): 	at android.os.Handler.dispatchMessage(Handler.java:99)
    E/AndroidRuntime(14287): 	at android.os.Looper.loopOnce(Looper.java:201)
    E/AndroidRuntime(14287): 	at android.os.Looper.loop(Looper.java:288)
    E/AndroidRuntime(14287): 	at android.app.ActivityThread.main(ActivityThread.java:7898)
    E/AndroidRuntime(14287): 	at java.lang.reflect.Method.invoke(Native Method)
    E/AndroidRuntime(14287): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    E/AndroidRuntime(14287): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
    
    opened by muccy 3
Releases(flutter_local_notifications-v11.0.1)
  • flutter_local_notifications-v11.0.1(Sep 23, 2022)

    • [Android] fixed crash when using notification actions with a foreground service. Thanks to the PR from Arnold Laishram
    • [Android] Suppressed deprecation warning on calling the getParcelableExtra Intent API
    • Fixed typo in readme around Darwin (iOS/macOS) initialisation settings
    • Added a link to an issue with using Flutter apps with desugaring enabled where crashes could occur on foldable Android devices. Link to this is https://github.com/flutter/flutter/issues/110658 so those experience the problem can follow the issue and try out the solutions there as this isn't specific to the plugin
    • Replaced usage of rxDart in example app use StreamController instead to minimise use of dependencies and removed unused shared_preferences dependency
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v11.0.0(Sep 17, 2022)

    • Bumped timezone dependency. To err on the safe when it comes to dependency version conflicts, this is being published as major release as the updated timezone package was published as a major release. Thanks to the PR from Joachim Nohl
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v10.0.0(Sep 17, 2022)

    • Breaking change [Android] zonedSchedule()'s implementation has switched to using desugaring instead of the ThreeTen Android Backport library. This required the plugin to update to using Android Gradle plugin 4.2.2 and applications may need to bump their Android Gradle plugin dependency to at least 4.2.2 as a result. Added a "Gradle setup" section underneath "Android setup" with details on the extra setup needed
    • [Android] Breaking change the following error codes included in PlatformExceptions that can occur on Android have been updated
      • INVALID_ICON -> invalid_icon
      • INVALID_LARGE_ICON -> invalid_large_icon
      • INVALID_BIG_PICTURE -> invalid_big_picture
      • INVALID_SOUND -> invalid_sound
      • INVALID_LED_DETAILS -> invalid_led_details
      • GET_ACTIVE_NOTIFICATIONS_ERROR_CODE -> unsupported_os_version
      • GET_NOTIFICATION_CHANNELS_ERROR_CODE -> getNotificationChannelsError
      • GET_ACTIVE_NOTIFICATION_MESSAGING_STYLE_ERROR_CODE -> getActiveNotificationMessagingStyle
      • PERMISSION_REQUEST_IN_PROGRESS -> permissionRequestInProgress
    • [Android] Breaking change the category of the AndroidNotificationDetails now requires an instance of the newly added AndroidNotificationCategory class instead of a string. This was to improve the discoverability of the APIs and improve the semantics as the category can specified in a similar fashion to using an enum value
    • Breaking change callbacks have now been reworked. There are now the following callbacks and both will pass an instance of the NotificationResponse class
      • onDidReceiveNotificationResponse: invoked only when the app is running. This works for when a user has selected a notification or notification action. This replaces the onSelectNotification callback that existed before. For notification actions, the action needs to be configured to indicate the the app or user interface should be shown on invoking the action for this callback to be invoked i.e. by specifying the DarwinNotificationActionOption.foreground option on iOS and the showsUserInterface property on Android. On macOS and Linux, as there's no support for background isolates it will always invoke this callback
      • onDidReceiveBackgroundNotificationResponse: invoked on a background isolate for when a user has selected a notification action. This replaces the onSelectNotificationAction callback
    • Breaking change the NotificationAppLaunchDetails has been updated to contain an instance NotificationResponse class with the payload belonging to the NotificationResponse class. This is to allow knowing more details about what caused the app to launch e.g. if a notification action was used to do so
    • [iOS][macOS] Breaking changes iOS and macOS classes have been renamed and refactored as they are based on the same operating system and share the same notification APIs. Rather than having a prefix of either IOS or MacOS, these are now replaced by classes with a Darwin prefix. For example, IOSInitializationSettings can be replaced with DarwinInitializationSettings
    • [macOS] Breaking change the requestPermissions() method of the MacOSFlutterLocalNotificationsPlugin class now only accepts non-nullable parameters that default to false. This makes it consistent with the iOS implementation of the plugin
    • Added support for notification actions. Massive thanks to Sebastian Roth, Pieter van Loon and Yaroslav Pronin for their work on this. Note that on Apple's platforms, notification actions are only supported on iOS 10 or newer and macOS 10.14 or newer
    • [Linux] Breaking change the linux notification categories defined by LinuxNotificationCategory no longer has factory constructors but has static constant fields instead to make the semantics more similar to access enum values
    • [Android] Updated how scheduled notifications are saved to shared preferences so it is done in the background. This is to fix issue 1378 where pendingNotificationRequests method may not report the correct number of scheduled notifications if it is invoked before the data had been saved to shared preferences
    • [Android] fixed issue 1702 by handling deprecation warnings using specific Android Intent APIs on Android 13 (API level 33) or newer
    • [iOS] getActiveNotifications() is now supported for iOS versions 10.0 or newer
    • [macOS] getActiveNotifications() is now supported for macOS versions 10.14 or newer
    • [iOS][macOS] thanks to the PR from maprohu, the following features are now available
      • the ability to request permissions to show critical notifications
      • the ability to specify the interruption level of a notification. This is only applicable to iOS 15.0 and macOS 12.0 or newer.
    • Updated minimum Flutter version to 2.8 as that aligns with the minimum Dart SDK version of 2.1.5 required by one of flutter_local_notifications_linux's dependencies (dbus)
    • Example app has been updated so that each notification has its own notification ID. Previously, they were all given a notification ID of 0
    • Updated Android setup docs to mention setting up compileSdkVersion
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v10.0.0-dev.23(Sep 12, 2022)

    • Fixed issue 1694 where tree-shaking was removing code related to background isolates and thereby preventing notification actions from firing. Readme has also been updated as applications will need to annotate functions invoked by the onDidReceiveBackgroundNotificationResponse callback with the @pragma('vm:entry-point') annotation as well. The example and docs have been updated to remove usages of the IsolateNameServer APIs due to issues in release builds. If anyone knows how to get these working then please submit a PR
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v9.9.1(Sep 3, 2022)

  • flutter_local_notifications-v10.0.0-dev.22(Sep 3, 2022)

    • Updated minimum Flutter version to 2.8 as that aligns with the minimum Dart SDK version of 2.1.5 required by one of flutter_local_notifications_linux's dependencies (dbus)
    • Includes changes from 9.9.1
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v9.9.0(Aug 29, 2022)

    • [Android] added the ability to specify audio attributes of a notification channel via the audioAttributesUsage property belonging to the AndroidNotificationChannel and AndroidNotificationDetails classes. Thanks to the PR from Jonas Bornold
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v10.0.0-dev.21(Aug 29, 2022)

  • flutter_local_notifications-v9.8.0+1(Aug 17, 2022)

    • Added more details to 9.8.0 changelog entry to mention that apps will need to change compileSdkVersion to 33 and also updated readme to mention this
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v9.8.0(Aug 17, 2022)

    • [Android] added requestPermission method to the AndroidFlutterLocalNotificationsPlugin class. This make use of the new feature added to Android 13 where an app can request permissions to show notifications. As the plugin's APIs don't have breaking changes, this is released a minor release. It does however, require the Android 13 SDK to be install installed and for apps to change the compileSdkVersion in their app's build.gradle to 33 as the plugin's compileSdkVersion is now 33. Only apps targeting Android 13 can request the permission as well. The latter can be done by updating the targetSdkVersion in an app's build.gradle file to 33. Thanks to the PR from Bartek Pacia. Note: the ability to request the permission as part of calling initialize will be added later on
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v10.0.0-dev.20(Aug 17, 2022)

    • Includes changes from 9.8.0
    • [Android] Breaking change the following error codes included in PlatformExceptions that can occur on Android have been updated
    • GET_ACTIVE_NOTIFICATION_MESSAGING_STYLE_ERROR_CODE -> getActiveNotificationMessagingStyle
    • PERMISSION_REQUEST_IN_PROGRESS -> permissionRequestInProgress
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v10.0.0-dev.19(Aug 17, 2022)

  • flutter_local_notifications-v10.0.0-dev.18(Jul 31, 2022)

  • flutter_local_notifications-v9.7.0(Jul 10, 2022)

    • [Android] added support to specify notification count via the number property that has been added to the AndroidNotificationDetails class. Thanks to the PR from Katsuya Kato
    • Updated readme so that link to icon design guidance points to the archived version as the original link is now returning 404 not found. Thanks to the PR from Zaldy Pagaduan Jr.
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v10.0.0-dev.17(Jul 10, 2022)

  • flutter_local_notifications-v9.6.1(Jul 10, 2022)

  • flutter_local_notifications-v10.0.0-dev.16(Jun 16, 2022)

    • Includes changes from 9.6.1
    • [Android] Breaking change the category of the AndroidNotificationDetails now requires an instance of the newly added AndroidNotificationCategory class instead of a string. This was to improve the discoverability of the APIs and improve the semantics as the category can specified in a similar fashion to using an enum value
    • [Linux] Breaking change the linux notification categories defined by LinuxNotificationCategory no longer has factory constructors but has static constant fields instead to make the semantics more similar to access enum values
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v9.6.0(Jun 4, 2022)

  • flutter_local_notifications-v10.0.0-dev.14(May 22, 2022)

    • Includes changes from 9.5.1 to 9.5.3+1
    • Breaking change [Android] zonedSchedule()'s implementation has switched to using desugaring instead of the ThreeTen Android Backport library. This required the plugin to update to using Android Gradle plugin 4.2.2 and applications may need to bump their Android Gradle plugin dependency to at least 4.2.2 as a result. Added a "Gradle setup" section underneath "Android setup" with details on the extra setup needed
    • Fixed progress notification example where the progress bar wasn't updating. Thanks to the PR from Lucas Ribolli
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v9.5.3+1(May 14, 2022)

    • Updated example app with to use updated Proguard rules for GSON
    • Update readme about GSON's Proguard rules to recommend referring to the rules on GSON's repository
    • Move note in readme about how onSelectNotification won't be called when an app is launched by a notification so it's more visible
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v9.5.3(May 14, 2022)

  • flutter_local_notifications-v9.5.2(May 6, 2022)

  • flutter_local_notifications-v9.5.1(May 5, 2022)

  • flutter_local_notifications-v9.5.0(May 3, 2022)

    • [Android] added getActiveNotificationMessagingStyle() method to the AndroidFlutterLocalNotificationsPlugin class. This allows for getting the messaging style information of an active notification e.g. to append a message to an existing notification. Thanks to the PR from Simon Ser
    • Updated readme to fix an issue where clicking on the Android setup and iOS setup sections from table of contents wouldn't go the appropriate section. Thanks to the PR from HendrikF
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v10.0.0-dev.13(May 3, 2022)

  • flutter_local_notifications-v9.4.1(Apr 23, 2022)

    • Calling initialize() on a platform with passing the appropriate initialisation settings for it will now throw an ArgumentError. Whilst this may be technically a breaking change, it's been done as a minor change as the call was already throwing an unhandled exception in these scenarios. This change is to help provide more information on why it fails. Documentation has also been updated to provide more on information on this as the intialisation settings for each platform are nullable so developers aren't forced to provide settings for platforms they don't target. Thanks to the PR from Zlati Pehlivanov
    • Updated docs to fix typos, adjust heading levels and use the term "daylight saving time" instead of "daylight savings". Thanks to the PR from Ross Llewallyn
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v10.0.0-dev.12(Apr 9, 2022)

    • Breaking change callbacks have now been reworked. There are now the following callbacks and both will pass an instance of the NotificationResponse class
    • onDidReceiveNotificationResponse: invoked only when the app is running. This works for when a user has selected a notification or notification action. This replaces the onSelectNotification callback that existed before. For notification actions, the action needs to be configured to indicate the the app or user interface should be shown on invoking the action for this callback to be invoked i.e. by specifying the DarwinNotificationActionOption.foreground option on iOS and the showsUserInterface property on Android. On macOS and Linux, as there's no support for background isolates it will always invoke this callback
    • onDidReceiveBackgroundNotificationResponse: invoked on a background isolate for when a user has selected a notification action. This replaces the onSelectNotificationAction callback
    • Breaking change the NotificationAppLaunchDetails has been updated to contain an instance NotificationResponse class with the payload belonging to the NotificationResponse class. This is to allow knowing more details about what caused the app to launch e.g. if a notification action was used to do so
    • [iOS][macOS] updated how notification categories were set behind the scenes so the categories specified. This fixes an issue where notification action may not work at all as were being appended to the list of existing categories. This could lead to issues where notification actions wouldn't work at all and potentially result in notification categories growing over time.
    • Updated docs to clarify that on Apple's platforms, notification actions are only supported on iOS 10 or newer and macOS 10.14 or newer
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v9.4.0(Mar 5, 2022)

  • flutter_local_notifications-v10.0.0-dev.11(Mar 5, 2022)

    • Includes changes from 9.4.0
    • Updated example app to display groupKey of an ActiveNotification
    • Bumped dependency to flutter_local_notifications_platform_interface
    Source code(tar.gz)
    Source code(zip)
  • flutter_local_notifications-v10.0.0-dev.10(Mar 1, 2022)

Owner
Michael Bui
A developer with a keen interest in building cross-platform applications
Michael Bui
Flutter Downloader - A plugin for creating and managing download tasks. Supports iOS and Android. Maintainer: @hnvn

Flutter Downloader A plugin for creating and managing download tasks. Supports iOS and Android. This plugin is based on WorkManager in Android and NSU

Flutter Community 753 Sep 23, 2022
File picker plugin for Flutter, compatible with both iOS & Android and desktop (go-flutter).

File Picker A package that allows you to use the native file explorer to pick single or multiple files, with extensions filtering support. Currently s

Miguel Ruivo 929 Sep 28, 2022
A Flutter plugin to easily handle realtime location in iOS and Android. Provides settings for optimizing performance or battery.

Flutter Location Plugin This plugin for Flutter handles getting location on Android and iOS. It also provides callbacks when location is changed. Gett

Guillaume Bernos 934 Sep 23, 2022
Flutter geolocation plugin for Android and iOS.

geolocation Flutter geolocation plugin for Android API 16+ and iOS 9+. Features: Manual and automatic location permission management Current one-shot

Loup 219 Aug 12, 2022
Android and iOS Geolocation plugin for Flutter

Flutter Geolocator Plugin A Flutter geolocation plugin which provides easy access to platform specific location services (FusedLocationProviderClient

Baseflow 1k Sep 28, 2022
Flutter Plugin for AR (Augmented Reality) - Supports ARKit on iOS and ARCore on Android devices

ar_flutter_plugin Flutter Plugin for AR (Augmented Reality) - Supports ARKit for iOS and ARCore for Android devices. Many thanks to Oleksandr Leuschen

Lars Carius 190 Sep 25, 2022
Telegram stickers importing Flutter plugin for iOS and Android

TelegramStickersImport — Telegram stickers importing Flutter plugin for iOS and Android TelegramStickersImport helps your users import third-party pro

Iurii Dorofeev 18 Jun 21, 2022
Plugin to retrieve a persistent UDID across app reinstalls on iOS and Android.

flutter_udid Plugin to retrieve a persistent UDID across app reinstalls on iOS and Android. Getting Started import 'package:flutter_udid/flutter_udid.

Leon Kukuk 181 Sep 15, 2022
Support to update the app badge on the launcher (both for Android and iOS)

Flutter App Badger plugin This plugin for Flutter adds the ability to change the badge of the app in the launcher. It supports iOS and some Android de

Edouard Marquez 256 Sep 16, 2022
A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.

Flutter InAppWebView Plugin A Flutter plugin that allows you to add an inline webview, to use an headless webview, and to open an in-app browser windo

Lorenzo Pichilli 2.2k Sep 28, 2022
A Flutter plugin that allows you to check if an app is installed/enabled, launch an app and get the list of installed apps.

Flutter AppAvailability Plugin A Flutter plugin that allows you to check if an app is installed/enabled, launch an app and get the list of installed a

Lorenzo Pichilli 87 Sep 15, 2022
A lightweight Flutter plugin for making payments and printing on MyPos

my_poster ?? my_poster is in beta - please provide feedback (and/or contribute) if you find issues ??️ A lightweight Flutter plugin for making payment

Antonio Mentone 3 May 30, 2021
Flutter library for iOS Widgets Extensions. Integrate a Widget into your App 🍏📱

flutter_widgetkit Flutter Library for the iOS ?? WidgetKit framework and Widget Communication Table of Contents ?? Introduction ??‍?? Installation ??‍

Fasky 213 Sep 22, 2022
Plugin to access VPN service for Flutter | Flutter 的 VPN 插件

Flutter VPN plugin This plugin help developers to access VPN service in their flutter app. 本插件帮助开发者在自己的应用内调用 VPN 服务。 The Android part was implemented

Xdea 259 Sep 21, 2022
Community WebView Plugin - Allows Flutter to communicate with a native WebView.

NOTICE We are working closely with the Flutter Team to integrate all the Community Plugin features in the Official WebView Plugin. We will try our bes

Flutter Community 1.4k Sep 14, 2022
Use dynamic and beautiful card view pagers to help you create great apps.

Use dynamic and beautiful card view pagers to help you create great apps. Preview New Feature v1.3.0 Change Alignment Left Center(Default) Right v1.4.

Jeongtae Kim 85 Sep 15, 2022
Flutter Local Notifications - Learn how to implement local notifications into both Android and iOS using flutter_local_notifications plugin.

Flutter Local Notifications Example Flutter Local Notifications - Learn how to implement local notifications into both Android and iOS using flutter_l

Sandip Pramanik 7 Aug 4, 2022
Ahmed Elsayed 134 Sep 28, 2022
An extension of flutter local notification, to simplify local notifications

Locally flutter local notification Locally helps developers create local notification with flutter on both Android and IOS platforms, it depends on th

Samuel Ezedi 19 Jul 22, 2022
Play simultaneously music/audio from assets/network/file directly from Flutter, compatible with android / ios / web / macos, displays notifications

?? assets_audio_player ?? Play music/audio stored in assets files (simultaneously) directly from Flutter (android / ios / web / macos). You can also u

Florent CHAMPIGNY 642 Sep 29, 2022