Skip to content Skip to sidebar Skip to footer

Widgets Configured With Android:configure Will Receive Onupdate Even If Configuration Is Unfinished

This is how I configure my APP's widget:

However, in the widget code itself (onUpdate), you still need to check whether configuration is complete, because APPWIDGET_UPDATE will definitely be called before configuration completion. You can just skip all updating altogether if configuration is not there, your widget will not be visible at this point anyway, and once configuration is complete, your widget is either removed by the system or its configuration is there.

One more thing. You need to initiate widget update from your configuration activity upon successful completion, because the system will not do it by itself.

Solution 2:

So it seems the Widget api documentation on developer.android.com is obsolete...

https://groups.google.com/d/topic/android-developers/HfD-ojjsuso/discussion

Solution 3:

"However, in the widget code itself (onUpdate), you still need to check whether configuration is complete, because APPWIDGET_UPDATE will definitely be called before configuration completion."

This is not the way it should be. On the android developer site you can read the following...

"The onUpdate() method will not be called when the App Widget is created (the system will not send the ACTION_APPWIDGET_UPDATE broadcast when a configuration Activity is launched). It is the responsibility of the configuration Activity to request an update from the AppWidgetManager when the App Widget is first created. However, onUpdate() will be called for subsequent updates—it is only skipped the first time."

Post a Comment for "Widgets Configured With Android:configure Will Receive Onupdate Even If Configuration Is Unfinished"