If we schedule an inexact repeating alarm with AlarmManager.setInexactRepeating
to be fired every hour, for example, what happens if the phone is in standby for 4 hours and then it is woken up? Does the system deliver 4 alarms in a row for the same PendingIntent
or does it deliver only a single alarm?
EDIT: reading the documentation with more attention, the set(int, long, android.app.PendingIntent)
method documentation says: Alarm intents are delivered with a data extra of type int called Intent.EXTRA_ALARM_COUNT
that indicates how many past alarm events have been accumulated into this intent broadcast. Recurring alarms that have gone undelivered because the phone was asleep may have a count greater than one when delivered.
So, when the phone comes out of standby, only one alarm will be delivered, with an intent extra that contains the number of missed alarms.
Reading the documentation with more attention, the set(int, long, android.app.PendingIntent)
method documentation says: Alarm intents are delivered with a data extra of type int called Intent.EXTRA_ALARM_COUNT
that indicates how many past alarm events have been accumulated into this intent broadcast. Recurring alarms that have gone undelivered because the phone was asleep may have a count greater than one when delivered.
So, when the phone comes out of standby, only one alarm will be delivered, with an intent extra that contains the number of missed alarms.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With