0

I've read the developers' guide about App Widgets and I've understood that to avoid ANR errors you should start a service within the onUpdate method of your AppWidgetProvider to update the widgets... I have a question about such a service: when we develop standard services, which can be started from an activity, we should avoid too long computations in onStartCommand, since the onStartCommand method runs in the main UI thread.. so, should we avoid long computations also within the onStartCommand of a Service started by the AppWidgetProvider or in this case we don't risk to block the UI? If we must avoid long computations in onStartCommand also in this case, could we start a worker thread within the service, or use an Intent Service? In this case can we update the widget with the updateAppWidget method of AppWidgetManager from whatever thread we want or do we risk to update the UI from outside the UI thread?

I hope the questions are quite clear..

4

1 に答える 1