MaikuB / flutter_local_notifications

A Flutter plugin for displaying local notifications on Android, iOS, macOS and Linux
2.47k stars 1.4k forks source link

Check zonedSchedule notifications after reboot #2341

Closed gkres closed 5 months ago

gkres commented 5 months ago

I have the following use case: a user will set an event up some time in the future and several notifications will be set up to act as reminders. A day before, 12h before, an hour before, etc.

If the user reboots the device the notifications are rescheduled and everything works as expected.

What I'm trying to achieve though is this: if the user turns the device off for some time and there are notifications to be shown in this time, they will all be shown once the device is turned back on. But at this point they could already be redundant, so is there a way to check notifications to be rescheduled after reboot and possibly dismiss them? On a case by case basis?

A parameter on a notification, that would tell the scheduler to skip them if in the past would work. But a function that would be run after the notifications are scheduled again post boot would be even better.

MaikuB commented 5 months ago

This isn't possible except on Android where rescheduling had to be done by the plugin due to how Android APIs work. If your app is fine with having this behaviour only on Android then this is something you would need to look into implementing yourself