I’m developing an AppWidget which uses a configuration activity to let you customize the widget behaviour. The customization must be stored somewhere and my first idea was to use shared preferences: when the configuration activity finishes, it stores values like optionA_ID, optionB_ID etc within the shared preferences, where ID is the appWidgetId.. My question is the following one: is the appWidgetId always the same, I.e. if a widget instance has an ID of 10 when it is created, will that widget instance always have the same ID, even after a reboot? If not, then this way of storing customizations will not work..
I’m developing an AppWidget which uses a configuration activity to let you customize the
Share
Based on this Google Groups post I believe the default behavior is that every instance of an app widget gets its own ID and keeps it permanently (unless of course it is removed and re-added or something). Also, all open-source apps like Email (from AOSP) store the ID in either SharedPreferences or a SQLite database and use that to determine what settings to apply to an app widget.