Menu

1 / 3

Reliable reminders in Flutter on Android: alarms, reboots and battery savers

DEV Community: kotlin·Ashraf Alrashidi·3 days ago
#7RZh6OyI
#devtokotlin#devto#dev#reminder#android
Long article (763 words) — no AI summary yet.
Reading 0:00
15s threshold

I build an Android app in Flutter that reminds people at set times of day. The screens took a week. Making the reminder actually arrive took longer, and almost none of it was Flutter code.

These are the notes I wish I had at the start. They cover a scheduled local reminder, not a push notification from a server.

A Dart timer is not a scheduler

Timer.periodic and Future.delayed run while your app process is alive and awake. Once the screen goes off and the system reclaims the process, the callback is gone. Nothing tells the user. The reminder simply never arrives, and the review says the app is broken.

Anything that has to survive that has to be scheduled with the platform, not with Dart.

Schedule with AlarmManager, from Kotlin

In my app the Dart side works out the next reminder time and calls a platform channel. The Kotlin side sets an alarm with AlarmManager and a PendingIntent that fires a BroadcastReceiver .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.