gdelataillade / alarm

A Flutter plugin to easily manage alarms on iOS and Android
https://pub.dev/packages/alarm
MIT License
132 stars 86 forks source link

Notification not showing while Alarm ring #200

Closed Riyaz7364 closed 1 month ago

Riyaz7364 commented 6 months ago

Alarm plugin version 3.1.3

Describe the bug Notification not showing on the screen while Alarm trigger. To stop the Alarm I have to force store the app. There must be a stop button and also when I set the alarm again while is running current alarm will stop, I think there must be a button to store the alarm then set another alarm

Expected behavior There must be a notification which show with title and body and the bottom to stop the alarm and stop must have a trigger to callback funtion

Device info Samsung a23, Android 13

gdelataillade commented 6 months ago

Hi @Riyaz7364

To stop the alarm you have to call the Alarm.stop method. In the future when I'll find the time I'll add a stop button to the notification: #58 When you set an alarm with the same id as an existing one, it will stop the existing one and replace it with the new one. If you want to manage your alarms separately, you need to use different ids.

Am I answering your questions ?

CntrlX commented 6 months ago

No actually i have this error tooo there is no notification when it rings

gdelataillade commented 6 months ago

Hi @CntrlX

Your notifications never show ? Make sure you asked for the notification permission. See permission_handler.

fimpact-nicole commented 6 months ago

@Riyaz7364 @CntrlX If you're using alarm package with flutter_local_notifications package, in my case, I had to write the code in the following order to make it work properly in main.dart. Just in case!

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await FlutterLocalNotificationsPlugin().initialize(settings: ...);

  await Alarm.init();
}