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

3.1.3 Version - java.lang.RuntimeException #195

Closed synstin closed 1 month ago

synstin commented 6 months ago

Alarm plugin version 3.1.3

Describe the bug

Exception java.lang.RuntimeException:
  at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:5286)
  at android.app.ActivityThread.-$$Nest$mhandleServiceArgs
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2531)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:230)
  at android.os.Looper.loop (Looper.java:319)
  at android.app.ActivityThread.main (ActivityThread.java:8893)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:608)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)
Caused by java.lang.NullPointerException:
  at com.gdelataillade.alarm.alarm.AlarmService.onStartCommand (AlarmService.kt:68)
  at android.app.ActivityThread.handleServiceArgs (ActivityThread.java:5268)

Device info Provide device info (Manufacturer, OS version, ...) [samsung t2s (Galaxy S21+ 5G)]

Additional context The error was found in the Google Play Console.

gdelataillade commented 6 months ago

Hi @synstin

How often does the issue happens ? I'll try to fix this issue for the next release. I'll keep you updated.

synstin commented 6 months ago

@gdelataillade This seems to happen quite often. Thanks!

mickeyjoes commented 5 months ago

This also happens to me in version 3.1.4 when the set alarm is supposed to trigger, the above exception occurs. Strange, because I had it working fine a week ago.

Samsung Galaxy S23 Ultra / Android 14

Thanks

mickeyjoes commented 5 months ago

Hey, I just managed to fix the issue in my case, so I figured out that in AlarmService.kt here https://github.com/gdelataillade/alarm/blob/main/android/src/main/kotlin/com/gdelataillade/alarm/alarm/AlarmService.kt#L63 that appIntent was null. Reviewing my AndroidManifest.xml I found that I've combined two different intent filters into one by mistake, which can cause unexpected behavior when resolving intents. After splitting into two intent filters it started working again.

gdelataillade commented 1 month ago

I'm closing this issue because in the meantime version 4.0.0 was released including a significant refactoring of the code and many bug fixes. Feel free to reopen if needed !