gdelataillade / alarm

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

3.1.3 Version - java.lang.RuntimeException #195

Open synstin opened 2 months ago

synstin commented 2 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 2 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 2 months ago

@gdelataillade This seems to happen quite often. Thanks!

mickeyjoes commented 2 weeks 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 2 weeks 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.