Does an onUpdate AppWidget called on boot?
I'm setting an alarm in the onUpdate and I wanted to know if the onUpdate will get called on boot or should I use the BOOT_COMPLETED intent.
Thanks.
I didn't find anything in the docs regarding this so I just tested it out. I set a Toast in the onUpdate()
method of my widget to see when it's triggered. After restarting the device it got triggered, so I assume that you don't need to use the BOOT_COMPLETED
intent, but sometimes you can't be sure enough(there is nothing against still using it).
Edit:
onUpdate() does get called on boot and the Android docs do cover this:
onUpdate()
Called in response to the ACTION_APPWIDGET_UPDATE and ACTION_APPWIDGET_RESTORED broadcasts when this AppWidget provider is being asked to provide RemoteViews for a set of AppWidgets. Override this method to implement your own AppWidget functionality.
Source
ACTION_APPWIDGET_UPDATE
This may be sent in response to a new instance for this AppWidget provider having been instantiated, the requested update interval having lapsed, or the system booting.
Source
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