java - Is alarmmanager ALWAYS cleared after reboot? -


simple question: alarmmanager always cleared after reboot? cleared after reboot on devices , when user boots device shortly after booted off?

i need know because recreate app's alarm in onbootreceiver , want avoid having double alarms set.

is alarmmanager cleared after reboot?

definitely on full reboot. there devices have "quickboot" (htc comes mind), , have not run experiments see behavior there.

and when user boots device shortly after booted off?

yes.

i need know because recreate app's alarm in onbootreceiver , want avoid having double alarms set.

alarms in hashmap keyed pendingintent. setting alarm using equivalent pendingintent should replace prior alarm. "equivalent", mean:

  • same operation (activity, service, broadcast)
  • same request code
  • equivalent intent (matches via filterequals(), pretty means matches on except extras)
  • and i'd nervous using flag_cancel_current when defining new pendingintent

you can use adb shell dumpsys alarm confirm alarms set, sure wind right number of alarms.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -