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

The alarm doesn't stop. #254

Open cho-4 opened 1 month ago

cho-4 commented 1 month ago

Alarm plugin version 4.0.3

Describe the bug Even if I force close the app in the background, the alarm sound does not stop. Of course, I tried Alarm.stop() using dispose() or didChangeAppLifecycleState, but it still doesn't stop. Oh, and on iOS, after I stop the alarm, the alarm doesn't come back on as set until I restart the app.

Device info galaxy s21, iphone XS max

gdelataillade commented 1 month ago

Hi @cho-4,

Thanks for your interest in the package.

Android: Indeed, if app is killed alarm keeps ringing. It will continue to ring until Alarm.stop is called. An alarm can be stopped with the notification action button STOP, which you can set using the NotificationSettings parameter.

iOS: I'm not sure to understand your concern, but unfortunately no alarm can ring if app was killed on iOS.

Let me know if you have any questions.

cho-4 commented 1 month ago

Thank you for your reply @gdelataillade

android: I'll try it according to your answer

ios: For example, when I press the set alarm button, the alarm does Alarm.set(), and when I turn off the alarm, it does Alarm.stop. However, I set the alarm time again and pressed the set alarm button, but the alarm did not sound even when the time I set reached. This problem does not occur if I close the app once and run it again.

Oh, and it looks like an additional problem has arisen. I set the alarm to go off after about 8 hours, put the app in the background, and waited, but it didn't go off, only on iOS. When you were testing, did the alarm go off when you set and waited this long?

I'll wait for your reply. Thank you.

gdelataillade commented 1 month ago

Hi @cho-4

1) Could you share some code and/or a screen recording showing the issue please ?

2) Yes, I tested my alarms waiting for several days. It can happen that iOS intentionally kills your app if it has a too important memory usage and it needs to free the memory. Using Xcode you can see a Memory Report where you can analyse the memory usage of your app. It could be interesting to check that.

Advice: first, in order to know whether the issue comes from the package code or from your app code, please test the example app of the package.