Is AlarmManager.setRepeating idempotent?

Posted by tardate on Stack Overflow See other posts from Stack Overflow or by tardate
Published on 2010-04-10T10:01:00Z Indexed on 2010/04/10 10:03 UTC
Read the original article Hit count: 644

Filed under:
|

In my android app, I'm setting an alarm that I want to occur repeatedly, hence using AlarmManager.setRepeating().

I don't want to keep track of whether the alarm is set myself (sounds like a bad idea that's prone to fail at some point), and there seems to be no API support for checking whether a particular alarm is already set for a given Intent.

Hence, I am pessimistically resetting the alarm each time my app activates:

alarmManager.cancel(pendingIntent);
...
alarmManager.setRepeating(..., pendingIntent); 

Question: is calling setRepeating() idempotent i.e. do I need to explicitly cancel() any prior alarm or can I safely just call setRepeating() and be done with it?

© Stack Overflow or respective owner

Related posts about android

Related posts about alarmmanager