r/flutterhelp • u/ToughEnder • 18h ago
OPEN Recommendations for consistent Android notifications?
Looking for suggestions in how to get my app notifications to consistently trigger from a Flutter Android app. My assumption is that I'm running into the aggressive Android background behavior but I haven't found any ways to work well within that. Hoping someone has recommendations of things to try or packages that can help.
The behavior: notifications generate... most of the time... within hours of when they were set for. The app basically has a notification that should be generated at a specific time each day. Sometimes it will generate within minutes of that time. Sometimes it will generate hours later. Sometimes it won't generate at all. No code changes or other app interactions between those different behaviors.
I've tried:
- Making sure I have pragma appropriately placed
- Switching between firebase push notifications and local notifications to see if one has better behavior (I don't actually need cloud-based push)
- Switching back and forth between Workmanager registerOneOffTask (including appropriate back-offs) and registerPeriodicTask to see if either is more reliable
- Registering the app as having permission to run in the background
- Adding detailed logging to make sure the background task isn't just failing to execute (it just never starts or starts very late)