I have installed the Android Alarm Manager plugin in my Flutter v1.0.0 app by following the instructions at the link. But when I try to use AndroidAlarmManager.oneShot(...)
nothing happens. There's not even an error in the console.
I am using a FutureBuilder
widget to wait on the AndroidAlarmManager.initialize()
future and one other future before my app begins rendering:
final combinedFutures = Future.wait<void>([
gameService.asyncLoad(),
AndroidAlarmManager.initialize(),
]);
FutureBuilder<void>(
future: combinedFutures,
builder: (context, snapshot) {
...
}
)
The FutureBuilder
does end up rendering what it should so I know that the AndroidAlarmManager.initialize()
future returns correctly.
Then in a button's onPressed
function I do this:
AndroidAlarmManager.oneShot(
Duration(seconds: 5),
0,
() {
print("test");
},
wakeup: true,
);
The above should be calling print(test)
after 5 seconds and waking up my phone but nothing is printed to the console and nothing happens on my phone. What is going wrong?