I'm implementing a Widget that has a ConfigurationActivity, and must stay compatible to Eclair(2.1).
The documentation about AppWidgetProviders onUpdate
method states clearly that:
... .However, if you have declared a configuration Activity, this method is not called when the user adds the App Widget, but is called for the subsequent updates. It is the responsibility of the configuration Activity to perform the first update when configuration is done. (See Creating an App Widget Configuration Activity below.)
Unfortunately this isn't true (at least for my Nexus S with JellyBean). In Fact onUpdate
gets called before onCreate
of my ConfigurationActivity triggers. I want to know, if there is similar behavior on other phones, and if it is possible to prevent the onUpdate
call inside my Provider?
My Workaround is to store a flag in SharedPreferences inside my WidgetConfigurationActivity with that particular AppWidgetId. If it isn't there, I can assume that the ConfigurationActivity wasn't called first. This works, but is in my point of View really ugly. If I cannot prevent onUpdate
from triggering, is there a better solution?