Is AlarmManager.setRepeating idempotent?
- by tardate
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?