Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the proper way to launch app using alarm manager?

Tags:

flutter

dart

I need to implement a flutter alarm app that opens through the alarm manager. It seems that there is the way to do it using android_intent and android_alarm_manager_plus. I was looking for the right way to create such functionality, but this option does not work:

await AndroidAlarmManager.oneShot(
      Duration(seconds: 2), 1, setAlarm);
void setAlarm()async{
  AndroidIntent intent =
      AndroidIntent(action: 'action_view', package: 'com.example.test_alarm');
  await intent.launch().catchError((e) {
    print(e.toString());
  });
}

Debug console gives this:

I/IntentSender( 4886): Cannot resolve explicit intent - ignoring package
V/IntentSender( 4886): Sending intent Intent { act=android.intent.action.VIEW (has extras) }
like image 588
mark titov Avatar asked Oct 15 '25 09:10

mark titov


1 Answers

try using https://pub.dev/packages/app_launcher

void setAlarm() async{
await AppLauncher.openApp(
  androidApplicationId: "com.example.test_alarm",
);

}

like image 182
DZ UY Scuti Avatar answered Oct 17 '25 01:10

DZ UY Scuti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!