2

I have already use flutter_local_notification plugin but some time it not work. i have also implement the all type notification like scheduled,show daily at a time,weekly but it can not proper work. - first can app is running on background is necessary when set a local notification? suggest me any other way for doing this. - second one question is should necessary to give a unique id to notification

my code is like below:

 Future setEverydayNotification(
 FlutterLocalNotificationsPlugin notifications, {
  @required String title,
  @required String body,
  @required Time time,
  int itemid,
  int id = 0,
  }) {
  return _showEverydayNotification(notifications,
  title: title, body: body, time:time, id: id,type: _onNotification );
  }

  Future _showEverydayNotification(
  FlutterLocalNotificationsPlugin notifications, {
  @required String title,
  @required String body,
  @required Time time,
  @required NotificationDetails type,
  int id = 0,
 }) =>
 notifications.showDailyAtTime(id, title, body, time, type,);

 NotificationDetails get _onNotification {
 final androidChannelSpecifics = AndroidNotificationDetails(
'3',
'name3',
'description3',
importance: Importance.Max,
priority: Priority.Max,
enableVibration: vibration,

);
final iOSChannelSpecifics = IOSNotificationDetails();
return NotificationDetails(androidChannelSpecifics, iOSChannelSpecifics);
}
dhruvi
  • 51
  • 1
  • 5

1 Answers1

-1

watch this video https://youtu.be/b6CTeqJnmN0

what I think is first try to check the youtube I added to my reply on how to use work manager, I think calling your dart code in work manager should work, just like an example I gave in the video, even if you not connecting the database and you want notification like every 1hr or 35 or any min you like, it the same step, just write a dart code that would get the current time and calculate the Min you want then call the notification function to display. I hope you got me, check the youtube video I uploaded

Habnarm
  • 19
  • 3
  • but how it work when i set the daily notification which shows the daily notification at specific time? – dhruvi May 15 '20 at 10:20