question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Alarm crashes when app is closed

See original GitHub issue

To reproduce

  1. Schedule an alarm.
  2. 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

  1. Trigger the alarm once when the app is running.
  2. Schedule it again to launch after some time.
  3. Close the app before the alarm will set off. This seems to not cause crash when the alarm is triggered.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
akinmac002commented, Jan 22, 2020

This problem is solved. On: https://github.com/emekalites/react-native-alarm-notification/issues/36 Furkan Atakan BOZKURT

0reactions
stale[bot]commented, Apr 10, 2020

Closed due to inactivity. Holler if this is a mistake, and we’ll re-open it.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found