Files
daily-notification-plugin/android/plugin
Matthew Raymer 83a0c1530d feat(android): add WorkManager deduplication for notification workers
Implement unique work names to prevent duplicate WorkManager tasks
from being enqueued when multiple notifications are scheduled for
the same time or when the receiver is triggered multiple times.

Changes:
- DailyNotificationReceiver: Use enqueueUniqueWork with unique names
  ("display_{id}", "dismiss_{id}") and ExistingWorkPolicy.KEEP/REPLACE
- DailyNotificationFetcher: Use unique work names based on scheduled
  time rounded to minutes ("fetch_{minutes}") with ExistingWorkPolicy.REPLACE

This resolves the issue where ~25+ concurrent workers were being
enqueued for the same notification, leading to race conditions and
resource waste. Now only one worker processes each notification/fetch
at a time.

Verified in logcat: Worker count reduced from 25+ to 1 per notification.
2025-11-02 07:23:09 +00:00
..