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

Application Crash #256

Closed rhaynel2024 closed 1 month ago

rhaynel2024 commented 1 month ago

Alarm plugin version ex: 4.0.4 (please update to the latest version before submitting the issue)

Describe the bug

To Reproduce *

  1. Create 3 alarms with 1 min gap
  2. When the first alarm arrived, do not click dismiss
  3. Wait for the 2nd and 3rd alarm to fire
  4. Application git crash

Expected behavior

Screenshots *

image

*

FATAL EXCEPTION: main (Ask Gemini) Process: com.itaimi.moonshot.alarm.stg, PID: 4785 android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{7cbaccb u0 com.itaimi.moonshot.alarm.stg/com.gdelataillade.alarm.alarm.AlarmService c:com.itaimi.moonshot.alarm.stg} at android.app.ActivityThread.generateForegroundServiceDidNotStartInTimeException(ActivityThread.java:2263) at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2234) at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2540) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8674) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)

gdelataillade commented 1 month ago

Hi @rhaynel2024,

Thank you for reporting the issue! The problem occurred because the foreground service alarms were being ignored, which led to unintended behavior.

I’ve released version 4.0.5 with a fix that addresses this. Please try it out and let me know if everything works smoothly!