-
Notifications
You must be signed in to change notification settings - Fork 0
Description
I think having the ability to send notifications about expiring items will be important.
- digest - daily, weekly, or monthly notification of whats expiring soon
- when something drops below 1 month
- ability to enable/disable this as a setting (shared prefs) - may also allow the threshold (30-60 days)?
See:
- https://medium.com/flutter-community/local-notifications-in-flutter-746eb1d606c6
- https://pub.dev/packages/flutter_local_notifications
- https://tonydavidx.github.io/how-to-run-background-tasks-in-flutter/
- https://pub.dev/packages/background_fetch
Basically, it looks like you setup an "alarm" recurring that will then check the data for expiring items and push a notification about them.
In general I would want this once a day. I think all the times are truncated to midnight so if I run this every 3-6 hours it should get them once a day and report on all of them.
There is some extra config/issue with getting access to other plugins and images in the push/alarm code. I may need to write my own plugin but I should be able to start with these packages and work from there... worst case I can use them as a guide for writing my own.
Using https://pub.dev/packages/workmanager according to https://www.geeksforgeeks.org/background-local-notifications-in-flutter/ had some positive results, but I was still unable to get notifications to fire when the app was closed... though it seemed to work when I started up the AVD, but when I opened and closed the app it no longer fired.
This is going to require more investigation.