Search code examples
androidalarmmanageralarm

Android - Is There A Delay When An Alarm Has Been Cancelled?


Can some other Android developers please confirm or deny what I have been seeing when working with the Alarm Manager. I set an alarm every 60 seconds. I then cancel the alarm at random times but all before the 60 seconds. I am seeing a delay when I cancel the alarm of sometimes up to 30 seconds.

Basically, 30-40 seconds after setting the alarm, I cancel the alarm, but it still goes off. I am assuming that the Alarm Manager is cancelling the alarms in the background and it may take a little while before the process is complete. Can anyone else confirm that this makes sense or does it sound like there is some other problem? Thanks!


Solution

  • So the real anwer to my question is NO! There is no significant delay when you cancel an alarm.

    It turns out that I was mistaken (Thank you Zapl!). I was cancelling the intent, but I was missing a new intent being fired just before with a slightly updated & different intent action. Thanks for letting me know that my thoughts of cancelling an alarm being slow was incorrect.