My app widget needs to be configured when it first added to the home screen. I want to open a configuration view right after the user adds the widget.
AppWidgetProvider has no onCreated event, so I’m showing the confugration activity on the onUpdate event, and store a boolean value in SharedConfiguration that marks that the configuration has already been shown. Is there an easier way?
In the AppWidgetProvider XML file there is an attribute called
android:configureYou can use this to point to an Activity to launch when the app is dropped onto the home screen. ex:
In your chosen configuration activity, the user can make whatever choice they want. You’ll need to grab and store the widget’s id. In the
onCreatemethod, get the id like this:When they’ve made their selection, use this to send a message back to your home screen widget that it is ready to be displayed:
That’ll get what you’re after.