Search code examples
androidalarmmanager

What would cause AlarmManager to stop


My app uses an AlarmManager to run a Service at a specific interval. Something is causing the AlarmManager to stop running, but I'm having a hard time debugging what it could be. I've heard if an exception is thrown in the Service this could cause the AlarmManager to stop, but I'm not seeing any exception in LogCat.

Any advice on how to debug an AlarmManager that auto-stops or what could cause it to stop?


Solution

  • I've heard if an exception is thrown in the Service this could cause the AlarmManager to stop, but I'm not seeing any exception in LogCat.

    I am not aware that this is the case.

    Any advice on how to debug an AlarmManager that auto-stops

    I'd use adb shell dumpsys alarm to confirm that the alarm really is gone.

    or what could cause it to stop?

    The only three things that I know of that will unschedule the alarm are:

    • if you do it via cancel()
    • if the device is rebooted
    • if somebody Force Stops your app

    Of course, a full uninstall will unschedule your alarms too.