The arguments that matter the most here are: The periodic method accepts the following arguments: static Future periodic(Īs you can see, this method is also similar in the arguments it takes. Instead of a delay of Duration type, the first argument is a DateTime object that sets when the alarm will be triggered. The oneShotAt method is very similar to the oneShot method, with one key difference. rescheduleOnReboot – A flag that indicates if the alarm will persist between reboots of the device.wakeup – A flag that indicates if the device will be woken up when the alarm will be triggered.exact – A flag that indicates if the timer will be set with tExact.allowWhileIdle – A flag that indicates if the timer will be set with tExactAndAllowWhileIdle or tAndAllowWhileIdle.alarmClock – A flag that indicates if the timer will be set with Android’s tAlarmClock.The first three arguments (delay, id and callback) are pretty self explanatory so we will focus on the rest. The oneShot method accepts the following arguments: static Future oneShot( periodic – triggers an alarm within a defined time interval.
We will be using the vanilla project that you get when you create a Flutter project in Android Studio (minus all the counter logic). Then run pub get to download the dependency.
In this article, we'll go over the Android AlarmManager Plus package and show how you can use it in your application.įirst, open up your pubspec.yaml file and add the following: dependencies:Īndroid_alarm_manager_plus: ^2.0.6 ✋ Disclaimer → When I wrote this article, the latest version was 2.0.6 Like most things related to Flutter, when you want to use a platform specific component, you need to expose its functionality. So if you are a Flutter developer, what do you do? If you are an Android developer, when you want to schedule your application to run at a specific time in the future, you use the AlarmManager.īut if you are an iOS developer, this type of component does not exist there.