Code Monkey home page Code Monkey logo

flutter_local_notifications's People

Contributors

12people avatar byrdkm17 avatar cimplesid avatar dependabot[bot] avatar domesticmouse avatar emersion avatar enduringbeta avatar ened avatar gianlucaparadise avatar guyluz11 avatar javiercbk avatar jeffscaturro-aka avatar jjs1015 avatar josh-burton avatar kaptnkoala avatar lucaslcode avatar maikub avatar nohli avatar nvx avatar proninyaroslav avatar rexios80 avatar sidlatau avatar stevekohls avatar tahamv avatar tarekbazine avatar tinhhuynh avatar tokenyet avatar udoy-touhid avatar wanbok avatar zaaru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_local_notifications's Issues

The README still uses NotificationDetailsIOS in 'Displaying a notification' section

var androidPlatformChannelSpecifics = new AndroidNotificationDetails(
    'your channel id', 'your channel name', 'your channel description',
    importance: Importance.Max, priority: Priority.High);
var iOSPlatformChannelSpecifics = new NotificationDetailsIOS();
var platformChannelSpecifics = new NotificationDetails(
    androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.show(
    0, 'plain title', 'plain body', platformChannelSpecifics,
    payload: 'item id 2');

should be

var androidPlatformChannelSpecifics = new AndroidNotificationDetails(
    'your channel id', 'your channel name', 'your channel description',
    importance: Importance.Max, priority: Priority.High);
var iOSPlatformChannelSpecifics = new IOSNotificationDetails();
var platformChannelSpecifics = new NotificationDetails(
    androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.show(
    0, 'plain title', 'plain body', platformChannelSpecifics,
    payload: 'item id 2');

Multiple Id:s for notifications

Hey!

I am using show notification at a specific day of the week. Have made it so that it will call the function multiple time, but it seems that I have to use a different ID for each call. This will be very crowded fast with a specific day of the week notification. Some items I have would have a notification for 6 days and that would mean that I need 6 different ID:s.

Is there any better way to handle this with the plugin?

Support for custom notification actions

The plugin should provide the ability to specify custom notification actions. However, this will depends on the Flutter engine being able to support headless-Dart code as per flutter/flutter#6192 and flutter/flutter#3671

It appears Android support is there but will wait to see on if the engine can support it for iOS applications, and for Flutter to provide abstractions to access the functionality. Without the support being added in, then this won't work for scenarios like when the application has been terminated as the logic associated with the action would've been defined in Dart.

Update with remaining work (IMO)

  • rework callbacks to deal with "foreground" and "background" notification actions. See #1489 for more detailed discussion
  • potential issue with setting notification categories affecting ability to see the notification actions #1481

Note that last two perhaps could be omitted given market share and those require using deprecated APIs

Edit:

  • there is headless execution on iOS but there are limitations at the moment. See flutter/flutter#23904. Upvote the issue on the Flutter repo if this concerns you to help the Flutter team prioritise
  • removed tasks on supporting older iOS and macOS versions given market share and those require using deprecated APIs

Navigating to a second screen in the example app doesn't result in a full-screen transition upon tapping on a notification on Android while the app is running

There's a strange navigation issue that's likely related to the Android lifecycle and how Flutter hooks into this. This doesn't seem to be a plugin issue as it works fine on iOS and if the users taps on the notification while the Android app is terminated then it works fine as well. Delaying the execution of the navigation code also works. Raised this at flutter/flutter#16636 and suggest other developers to vote for it to be investigated

schedule day interval

I have a Duration which is, for example, two days and four days.

Is there any way we can schedule a notification to happen every two days and every four days?

Remove the need for didReceiveLocalNotification when using the UILocalNotification APIs (iOS version < 10)

Current advice is for developers using the plugin to handle the didReceiveLocalNotification method within the app delegate of their iOS head project. In theory, it should be possible to handle this within the plugin itself since the plugin is registered as an application delegate. However, the method never fires when trying to handle it within the plugin.

This has been raised on the Flutter repository flutter/flutter#16662 for the Flutter team to look into. Suggest anyone that would like the Flutter team to look into it to vote with a thumbs up as this seems to be how they prioritise looking at issues

flutter_local_notifications conflict with the firebase_messaging 1.0.1

The firebase_messaging doesn't work properly in iOS platform when we apply firebase_messaging plugin and flutter_local_notifications plugin together, but it works fine in Android platform.

Without the firebase_messaging plugin, our app works fine and can receive all of the callbacks (onMessage, onLaunch, onResume) from firebase_messaging.
Unfortunately, the callbacks don't be called once we apply the flutter_local_notifications plugin.
_firebaseMessaging.configure(
onMessage: onMessage, onLaunch: onLaunch, onResume: onResume);
Anyone can help to look into this issue?
Here is the firebase_messaging link.
https://pub.dartlang.org/packages/firebase_messaging

ChromeOS

Has anyone tested this on ChromeOS ?

Push after receiving notification

Hi,
When notification is received I want to open the app (if it's killed or in the background) and navigate to a specific view. The problem is that i don't know which build context to pass to a navigator in order this to work. The solution provided in example project is not working for me because, when I kill the app and open it by tapping on the notification I land on home view of my app and transition to other view is not occurring.

Add support for android setOnlyAlertOnce

Would it be possible to add support for setOnlyAlertOnce on Android? I don't know if there's an equivalent for iOS and if it makes sense to diverge the functionality between Android and iOS.

Repeat Interval after a future date

Is it possible to set a future DateTime using "flutterLocalNotificationsPlugin.showDailyAtTime".

Example: I want to set a notification next week. After that week, I want a daily message at a specific time.

I can't find any solutions to solve my problem.

Sound and vibration when showing the notification

Hello,

Is there a way to configure sound and or vibrations in android when displaying the notification?

I see the IOS initial settings allow to pass a sound and badge values on initial settings but the android part only takes default icon.

Thanks

Scheduling multiple notifications on Android

I am not sure if this is an issue with the plugin or my implementation. I am unable to schedule multiple notifications on Android correctly. I am using time in milliseconds to create new channels for each scheduled notification however they display at the wrong time. I scheduled 3 notifications at 1 minute, 3 minute, and 5 minutes. The last two showed up at the same time but showed up at 5 minutes.

Receiver android

Is receiver necessary for receiving android scheduled notifications, because for ios you dont need nothing else than the configuration

Scheduled notifications issue

Demo app seems to be working fine.
Also when I use the code within my app for showing immediate notification "_showNotification()" , it also works.

But other notifications like, show notification after 5 seconds or show notification at specific time of day are not working.

Am am missing some configuration?

I am calling _showDailyAtTime(); withing initState() function.

Future _showDailyAtTime() async {
    var time = new Time(16, 23, 0);
    var androidPlatformChannelSpecifics = new AndroidNotificationDetails(
        'your channel id', 'your channel name', 'your channel description',
        importance: Importance.Max, priority: Priority.High);
    var iOSPlatformChannelSpecifics = new IOSNotificationDetails();
    var platformChannelSpecifics = new NotificationDetails(
        androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
    await flutterLocalNotificationsPlugin.showDailyAtTime(
        0,
        'show daily title',
        'Daily notification shown at approximately at',
        time,
        platformChannelSpecifics);
  }
@override
  void initState() {
    // TODO: implement initState
    super.initState();

    var initializationSettingsAndroid =
        new AndroidInitializationSettings('app_icon');
    var initializationSettingsIOS = new IOSInitializationSettings();
    var initializationSettings = new InitializationSettings(
        initializationSettingsAndroid, initializationSettingsIOS);
    flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin();
    flutterLocalNotificationsPlugin.initialize(initializationSettings,
        selectNotification: onSelectNotification);
    _showDailyAtTime();
  }

[Feature] Permanent / persistent Notifications

I'd like to see a feature to have a persistent / permanent Notification, that cannot be dismissed.

I myself are very new to Flutter / Dart / Mobile Development, so i wont be able to submit a PR myself (although i am very happy to help where i can).

Example use case:

My app has a offline storage for user experience. If there are changes made that are no yet pushed to the remote server-backend i like to show a permanent notification so the user is reminded he has to open the app to trigger a sync.

Ongoing notifications not sticky?

Using the example app, seems like ongoing notifications can still be swiped away and dismissed in the tray on Android? Is there a way to make it sticky?

Compatibility issues when used with firebase plugins

if you use the latest versions of the firebase plugins you get the next error

Android dependency 'com.android.support:support-compat' has different version for the compile (27.0.1) and runtime (27.1.0) classpath.

Android crashes with "Invalid notification (no valid small icon)"

Hi

I'm having problems configuring this for Android. Whatever I do, I can't seem to identify the icon correctly, meaning every notification throws the following crash:

java.lang.RuntimeException: Unable to start receiver com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver: java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(channel=FEA_NOTIFICATION pri=1 contentView=null vibrate=null sound=null defaults=0x0 flags=0x10 color=0x00000000 vis=PRIVATE)

Android setting are configured thus:

final initializationSettingsAndroid = AndroidInitializationSettings(ICON_NAME');

And I've tried every combination I can think of for ICON_NAME: app_icon, ic_launcher, ic_launcher.png, @mipmap/ic_launcher and so on.

I wonder if I'm just doing something stupid? Is there something obvious I'm missing?

Many thanks

Nic

It all works beautifully on iOS, BTW - many thanks for this.

Android wrong notification time

So this works correctly on IOS but not on Android. The problem is that when I've used a one-time notification that will fire in, for example, 20h. When the notification pops up it says that notification came 20h ago and not now.

To clarify. I set a notification in 20h. When 20h has gone by and the notification appears it says 20h on the notification (the time when the notification appeared). On IOS, however, it displays it normally so it won't say 20h but more like 1 min etc

My Build fails

I am very new to Flutter so maybe someone can help me.
When I have added this package to the pupspec.yaml the following error comes up:

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:preDebugBuild'.

Android dependency 'com.android.support:support-compat' has different version for the compile (26.1.0) and runtime (27.1.0) classpath.

Icon not working on Android

Hello. I am fairly sure I am just misunderstanding the syntax, but I cannot get Notifications to show on Android.

This is my Android initialization settings:

    InitializationSettingsAndroid initializationSettingsAndroid = new InitializationSettingsAndroid('app_icon');

And when I schedule a notification, I get the following error

Caused by: java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(channel=DEFAULT pri=2 contentView=null vibrate=null sound=null defaults=0x0 flags=0x0 color=0x00000000 vis=PRIVATE)

No matter what I put for 'app_icon', such as a path to an image, "app_icon" itself, i still get this error. Any help would be greatly appreciated.

Android dependency 'com.android.support:support-compat' has different version for the compile (25.2.0) and runtime (27.1.0) classpath

When I add flutter_local_notifications: "^0.1.0" to pubspec.yaml, I get this error when I start my project.

app:preDebugBuild'. Android dependency 'com.android.support:support-compat' has different version for the compile (25.2.0) and runtime (27.1.0) classpath. You should manually set the same version via DependencyResolution

I resolved it by adding the below to android\build.gradle file

allprojects {
    repositories {
       //...
    }
    subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.android.support'
                        && !details.requested.name.contains('multidex') ) {
                    details.useVersion "27.1.0"
                }
            }
        }
    }
}

After it was resolved, there is still this warning in Run console

Note: C:\Users\xxx\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\flutter_local_notifications-0.1.0\android\src\main\java\com\dexterous\flutterlocalnotifications\FlutterLocalNotificationsPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

Testing custom notification sounds on older iOS devices (iOS version < 10)

Don't have an old iOS device to test if the code for using custom sounds works on older devices. The code looks right but the sound won't play on the simulator, which seems to be a common issue that has been reported by other iOS developers.

Be good if someone in the community could confirm it works for them unless I can source an older device for testing

Multiple Daily Notifications

Thanks so much for writing this plugin, it's incredibly useful. Hopefully those final issues get cleared out with flutter soon so it can be officially adopted.

Onto the not so great part, I have two different and independent notifications scheduled to be shown daily calling showDailyAtTime . One is shown in the morning, and the other in the evening. They both have unique notification ids and titles, while the body is the same.

If I schedule them to display relatively close to the current time, they will both execute and display. However the next day only the last one scheduled will display, which is the evening one in our case. The code execution is as follows:

  • (await) cancel all existing notifications through plugin
  • (await) schedule morning reminder
  • (await) schedule evening reminder

Have you seen anything similar or know of any current issues that may cause this? Thanks.

RepeatInterval.EveryMinute actually notifies every 5 minutes on actual Samsung S7 w/8.0

I built the example code with no changes (flutter build apk). When I run it on my actual device (Samsung S7 Edge with Android 8.0) and click "Repeat notification every minute", I actually get a notification every 5 minutes (not every minute).

I tried the same apk on an an emulator (Pixel 2 XL API 24) and it notified every minute as expected.

Very odd.

Support for notification badges on iOS and Android?

Do you plan to support app icon notification badges for iOS and Android? :)

Or maybe I just overlooked the functionality in the current plugin. Anyhow, would love to see the feature built in.

My use case is simple for a start - when a user gets pushed a notification (scheduled) an app icon badge gets applied. A low-level starting scenario could be binary - either the badge is shown with a "1" on it no matter how many notifications have been pushed since their last open or it's not there at all.
Once the user opens either the notification or the app itself, simply expose a function to clear the badge.

Otherwise, loving the package. So awesome work ๐Ÿ‘

Context is null in onSelectNotification

Based on your examples. When application is in foreground I tap on just received notification then the Context is null. How do I navigate user to next screen?

 @override
  void initState() {
    super.initState();
    flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin();
    flutterLocalNotificationsPlugin.initialize(initializationSettings,
        selectNotification: onSelectNotification);
  }

 Future onSelectNotification(String payload) {
   // in this method I am missing context - it's null. So when Notification is tapped on I'd like to redirect user to specific screen. Do you know how to get context here?
    Navigator.of(context).push(new PageRouteBuilder(
          pageBuilder: (_, __, ___) => new HistorieItemScreen(),
        ));
  }

Day Interval feature IOS < 10

Sorry to disturb your again, If I would ignore IOS version < 10. How would I implement a day interval for notifications?

Ex: every other day, every third day, every second week?

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?

Schedule non recurring notification

HI

Right now when you schedule a notification for a specific date time it repeats every day.

I'd like to have an option to schedule a single notification, is that possible?

I'm using:

  flutter_local_notifications: ^0.3.6

Support setting a repeating notification in a custom hour and minute

I want to schedule a notification everyday at 10 AM. But currently I depend on the time that the notification is being setted up.

What I'm thinking is the following

final now = new DateTime();
// the first notification should be on 10:00 AM, so we set that date and set a daily interval
final firstNotification = new DateTime(now.year, now.month, now.day, 10, 0);
await flutterLocalNotificationsPlugin.periodicallyShow(
        ALARM_NOTIFICATION_ID,
        ALARM_TITLE,
        ALARM_BODY,
        RepeatInterval.Daily,
        platformChannelSpecifics,
        firstNotification); // the date starting date of the notification

What do you think?

Thanks

flutter_local_notifications and cloud_firestore together cause build failure

Here is the context:
with Android Studio 3.1.3, I was able to have the dependency to
cloud_firestore: ^0.7.4
or to
flutter_local_notifications: ^0.3.6
separately, however, once I have dependencies to both
then I got the following error:

Launching lib/main.dart on LG SP200 in debug mode...
Initializing gradle...
Resolving dependencies...
Running 'gradlew assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'com.android.support:support-compat' has different version for the compile (26.1.0) and runtime (27.1.0) classpath. You should manually set the same version via DependencyResolution

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
Finished with error: Gradle build failed: 1

Please help me to overcome the error. I must use both. Thanks,

Crashes with no notifications on Android 8.0 (Oreo)

Ran the example app on my Samsung S7 Edge with Android 8.0 (Oreo) and no notifications are sent.

Clicking the first button produces the following output, but no notifications appear:

E/MethodChannel#dexterous.com/flutter/local_notifications(16770): Failed to handle method call
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(channel=your channel id pri=1 contentView=null vibrate=null sound=null defaults=0x0 flags=0x10 color=0x00000000 number=0 vis=PRIVATE semFlags=0x0 semPriority=0 semMissedCount=0)
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): 	at android.app.NotificationManager.notifyAsUser(NotificationManager.java:335)
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): 	at android.app.NotificationManager.notify(NotificationManager.java:299)
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): 	at android.support.v4.app.NotificationManagerCompat.notify(NotificationManagerCompat.java:210)
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): 	at android.support.v4.app.NotificationManagerCompat.notify(NotificationManagerCompat.java:194)
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): 	at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:528)
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): 	at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:459)
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:191)
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): 	at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:136)
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): 	at android.os.MessageQueue.next(MessageQueue.java:325)
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): 	at android.os.Looper.loop(Looper.java:142)
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): 	at android.app.ActivityThread.main(ActivityThread.java:6944)
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): 	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
E/MethodChannel#dexterous.com/flutter/local_notifications(16770): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Lost connection to device.
Exited (sigterm)

Support For Notifications With Custom Views : A Player App Use Case

I have been trying to wrap my mind about implementing a player app control widget in a Flutter app that appears as a notification and on locked screen, it is shows basic player controls.
I was about to start thinking about implementing them myself and then I came across this plugin, please a sample code showing how to achieve might really helpful for me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.