HabitRPG / habitica-android

Native Android app for Habitica
GNU General Public License v3.0
1.45k stars 514 forks source link

Notifications for dailies arrive ~5 minutes late than intended reminder time #2068

Closed martyn0ff closed 5 months ago

martyn0ff commented 6 months ago

First of all, I would like to say thanks to the team for making this amazing application. I'm excited for incorporating the app into my daily life.

Describe the bug I see that this is quite common bug. I don't receive push notifications for dailies, however I might have been able to pinpoint circumstances under which push notifications never come: notifications get sent only if "Start Date" under "Scheduling" is set to the date that is today. If a date is set to date in the past or in the future, push notifications are never sent.

To Reproduce Steps to reproduce the behavior:

  1. Create a daily, doesn't matter how often it is supposed to repeat.
  2. Ensure that "Start Date" is set to today's date.
  3. Add reminder with time set in the future
  4. Wait until set time comes, and push notification comes as expected.
  5. Set "Start Date" to any other date in the past or in the future.
  6. Update existing reminder's time to future time (or create another one, doesn't matter)
  7. Push notification never comes.

Expected behavior I would have expected to receive a notification when "Start Date" is set in the past, but not in the future. Also, as I was playing around, I discovered that if a daily is set to be relevant on certain days of the week, a reminder will fire anyway regardless of what day of the week it is (if "Start Date" is set for today). I probably would have expected a reminder to fire only on relevant weekdays,

Screenshots Not applicable.

Smartphone (please complete the following information):

Additional context Not applicable.

martyn0ff commented 6 months ago

Update: actually, reminders do work even for the dates that are in the past. However, such reminders are quite late: for start date that is "today" push notification arrives within 5-10 seconds, while for starting date in the past it takes a whopping 3-4 minutes. Perhaps a workaround for now is to set your reminders 5 minutes earlier than your initial intention.

saraolson commented 5 months ago

Unfortunately this issue is due to the constraints of the Android OS. We schedule the notification, but when it's delivered is up to Android. Changing the time by 5 minutes won't reliably deliver your reminder at the time you expect because of this. Sometimes they're on time, sometimes they're 2 minutes off, sometimes they're 30 minutes off.

The best advice at the moment is to go into your device's Settings app and turn Habitica's battery optimization to 'Unrestricted' or find the 'Alarms and Reminders' setting and be sure it's marked as allowed. We also recommend turning off the option to pause app activity if unused as this can undo these preferences unexpectedly. These settings may vary based on your device.