Closed berkaycelebi closed 3 months ago
Have you checked the other values for the AndroidSchedule
enum? My understanding is AndroidScheduleMode.inexactAllowWhileIdle
would've been what you're after
Thanks. inexactAllowWhileIdle
solved the problem.
We focused on only inexact and exact and could not see other options. Thanks you for your time. I am closing this issue.
@berkaycelebi Did you test it while app is in background?
I noticed that when the app is in background (app terminated), the notification scheduled is ok.
But, when the app is in background and not terminated (app is minimized), don't show the notification scheduled, using inexactAllowWhileIdle
.
In our app, we send notifications every 3 hours from 08:00 to 22:00 (e.g., water reminder notifications). We use zonedSchedule to achieve this.
However, many users report receiving most notifications all at once. After investigating, we found that when the device is in idle mode (Doze mode), the alarm manager doesn't work as expected, as described in the Android documentation.
Our notifications don't need to be sent at an exact time, but we expect them to be received within a few hours. In reality, users sometimes don't receive notifications for a whole day and then receive all of them at once. (mostly in android 13+)
Here is our working code:
Is it possible to set up notifications to be sent at inexact times and avoid receiving them all at once? Or what should we do to resolve the described issue?