Smart Notifications: Recurrence, Badges, and Android Pitfalls
Notifications in a task manager are critical. Reminders must be reliable. On Android, it's a nightmare.
The Recurrence System
I schedule the next 30 occurrences of a recurring reminder all at once. Why not just the next one? Because Android can kill the app at any time, and the scheduling logic with it.
The Restart Problem
Upon phone restart, scheduled notifications are lost on some devices. Samsung, Xiaomi, Huawei block the BOOT_COMPLETED broadcast. Solution: re-check and reschedule upon each app opening.
Firebase Cloud Messaging
For pushes (group activity, unlocked badges): FCM. The pitfall: FCM tokens change. Refresh on launch, store in DB, clean up invalid ones.
Icon Badges
The small red circle on the icon. On iOS: one line of code. On Android: each launcher has its own API. Samsung, Nova Launcher, AOSP — all different. I accepted this fragmentation as a reality.
Gamification Notifications
The most satisfying. Badge unlocked: local notification with custom icon. Streak milestone: "30-day streak! Keep it up." This small personalized message transforms a notification into motivation.