Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter app, check daily at x time to see if I need to send local notification to user

I am a little uncertain as to how I could go about doing this task and was hoping for some clarification.

The APP: It reminds people to water their plants and the user can specify how often they wish to do so.

The problem I am facing is how I can go about sending the local notifications to the user. Instead of setting up an individual notification for each new plant they have with a scheduled time to go off. I was hoping I could specify a time of the day (say 8:00 in the morning) where my app runs through all my plants and checks if any require watering today. If they do, it then tells the user through a local notification saying for instance "You have 5 plants to water today" and when they click on it they go through to the app which shows them what plants they are.

  • Should I be using the Alarm Manager api for a daily alert? But can this run a script to check plant data and then send a local notification.
  • Or is it best to just attach an individual local notification to each plant?

Now I am still a novice at Android/Flutter development and just a little unsure what the best practices are for this? Hope I was clear enough in what I said, happy to answer any further questions. Thanks in advance for any help.

like image 647
Michael Johnston Avatar asked Dec 18 '19 13:12

Michael Johnston


People also ask

How do I schedule local notification on Flutter?

After the Initialization, the notification can be scheduled using zonedschedule() method. In that, we should give notification details like Title, description, etc. Android and iOS get their own notification details like android has channels, so we should give channel id, channel name, importance, priority, etc.

How do I show Flutter local notification while receiving push notifications on foreground?

Foreground and Notification messages Notification messages which arrive while the application is in the foreground will not display a visible notification by default, on both Android and iOS. It is, however, possible to override this behavior: On Android, you must create a "High Priority" notification channel.

How do I set a reminder on Flutter?

First you have to create a notification service class and an instance of notification plugin. Then 1 and 2 from above tasks list. You have to check your settings and icon name accordingly.


1 Answers

I think that this package will help.

like image 142
Ruben Martirosyan Avatar answered Oct 16 '22 16:10

Ruben Martirosyan