Reputation: 11318
When the device is restarted, my appWidgets are all broken. In my WidgetProvider
class i have implemented only the onRecieve
method, since i'm using a ConfigureActivity
to create the widget. What method should I override on the WidgetProvider for my widget to be updted properly when the device is restarted?
Upvotes: 0
Views: 536
Reputation: 11318
When the device reboots, all the desktop widgets are rebuilt via the onUpdate
method in the WidgetProvider
class. Just implement this method to recreate your widget as shown here.
Upvotes: 2
Reputation: 5961
If I understand your problem correctly, register to receive the ACTION_BOOT_COMPLETED broadcast, and re-create your widget when you receive it.
Make sure you also hold the RECEIVE_BOOT_COMPLETED permission.
It's best practice to make sure you respond and exit from your BOOT_COMPLETED handler as quickly as possible - spending too long responding to BOOT_COMPLETED will give a poor user impression of the platform.
Upvotes: 1