Alarm crashes when app is closed
See original GitHub issueTo reproduce
- Schedule an alarm.
- Close the app before the alarm will set off. This should cause a crash when the alarm is triggered.
This is how errors look like from adb logcat:
AndroidRuntime: FATAL EXCEPTION: main
AndroidRuntime: Process: com.nativetest, PID: 2913
AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.emekalites.react.alarm.notification.ANAlarmReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.nativetest/com.emekalites.react.alarm.notification.ANService (has extras) }: app is in background uid UidRecord{a75b117 u0a85 RCVR idle change:idle|uncached procs:1 seq(0,0,0)}
AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3388)
AndroidRuntime: at android.app.ActivityThread.access$1200(ActivityThread.java:199)
AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
AndroidRuntime: at android.os.Looper.loop(Looper.java:193)
AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6669)
AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
AndroidRuntime: Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.nativetest/com.emekalites.react.alarm.notification.ANService (has extras) }: app is in background uid UidRecord{a75b117 u0a85 RCVR idle change:idle|uncached procs:1 seq(0,0,0)}
AndroidRuntime: at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1577)
AndroidRuntime: at android.app.ContextImpl.startService(ContextImpl.java:1532)
AndroidRuntime: at android.content.ContextWrapper.startService(ContextWrapper.java:664)
AndroidRuntime: at android.content.ContextWrapper.startService(ContextWrapper.java:664)
AndroidRuntime: at com.emekalites.react.alarm.notification.ANAlarmReceiver.onReceive(ANAlarmReceiver.java:20)
AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3379)
AndroidRuntime: ... 8 more
AudioFlinger: not enough memory for AudioTrack size=131296
AudioFlinger: createRecordTrack_l() initCheck failed -12; no control block?
IAudioFlinger: createRecord returned error -12
AudioRecord: AudioFlinger could not create record track, status: -12
AudioRecord-JNI: Error creating AudioRecord instance: initialization check failed with status -12.
One way around seems to be
- Trigger the alarm once when the app is running.
- Schedule it again to launch after some time.
- Close the app before the alarm will set off. This seems to not cause crash when the alarm is triggered.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
alarm clock crashes when I try to add an - Apple Discussions
Hi. My alarm clock doesn't allow me to add a new alarm ou edit one. It simply crashes (minimizes the clock) when I...
Read more >Bug crashes Google Clock alarm app; Are you affected? Here ...
Google Clock app alarm: It looks like Google app has been affected by a bug that could cause you to miss your alarms....
Read more >Alarms and Clock app is crashing - Microsoft Community
Step: 1 Uninstall and try reinstalling the app and check if it helps. If the issue still persists try method 2,. Method ...
Read more >"Unfortunately, Clock has stopped" when trying to create or ...
"Unfortunately, Clock has stopped" when trying to create or edit alarm · Delete Data from App Manager · Clear cache · Restart the...
Read more >How to fix clock app crashing when creating new alarm (iPhone)
How to fix clock app crashing when creating new alarm (iPhone) ... If your Android apps keep crashing / closing here is how...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This problem is solved. On: https://github.com/emekalites/react-native-alarm-notification/issues/36 Furkan Atakan BOZKURT
Closed due to inactivity. Holler if this is a mistake, and we’ll re-open it.