APPLICATION: Task reminders. The user creates a task and schedules when this task is due.
This package flutter_local_notification allows me to schedule a future notification to the user when they create this task. Which is fine if I schedule one notification for when the task is due.
However, if the user forgets to complete that task and the day has now past when the task was due (with the original notification been and gone). I would like the app to continue to notify the user that they haven't completed this task yet once every day, until they open the app to cancel the notification/mark the task as complete.
I'm certain that others must have already created something like this, but I'm struggling to find clear solutions online so thought I would ask here and see peoples opinions on what would be best practice.
Two solutions I can think of:
Daily background task
A background task to run once a day to check what tasks are due and overdue for that current day and then schedule a notification for some point later during that day.
Series of events
- At 00:00 every day the app runs a background task checking what tasks are due today
- If a task is due today, or is overdue. Schedule notification for later that day.
- If the app is never opened, this process of checking and sending notifications repeats everyday.
Repeating notification everyday
Example Task due on "Monday"
Instead of having a background task run everyday. For this example task I'm thinking I could schedule a notification on the Monday, and at the same time also schedule a daily repeating notification for every day after (Tuesdays, Wednesday, Thursday...) indefinitely. Then if the user opens the app and completes the task, these repeating notifications are cancelled. If not, the user gets notified every day until they do.
I think this method would work, but I want to avoid scheduling so many notifications in the future and only have "todays" notifications scheduled. As this app could potentially have lots of tasks created by the user.
My flutter app is only running only on Android at the moment, but I don't want to rule out iOS. So ideally a method which works cross-platform.
All the data is stored locally, so I can't have a backend completing the data checks and sending push notifications.
Thoughts on the solutions to this problem?