One more thing:

Android uses the same Linux process for your WidgetProvider as well as service that updates the widget (again, I'm assuming you followed the Wikipedia sample).

The WidgetProvider will be created and invoked as necessary, this, in turn, should cause your service to be started when you call "startService(this, UpdateService.class)".

A task killer is likely to interfere with the first part of this sequence - i.e. preventing the WidgetProvider from responding to update events in the first place.

-- Kostya

31.08.2010 23:50, Kostya Vasilyev пишет:

If your code is set up along the lines of the Wikipedia sample widget (which it seems to be), and the widget's onUpdate invokes the service with startService, then everything should be fine already. StartService will, obviously, start the service as necessary.

If there are still problems updating the widget, ask your user to add your service to the task killer's exclude list. Better yet, try to educate the user about the evil nature of task killers, perhaps he/she will stop using them altogether.

--
Kostya Vasilyev -- http://kmansoft.wordpress.com

31.08.2010 22:14 пользователь "Alex" <[email protected] <mailto:[email protected]>> написал:

What is the correct way to ensure that a widget update service is
restarted if it has been killed?

In my widget, I start the service in the onUpdate event, but if the
widget and service are killed (by a task killer, for example), the
widget restarts, but the service doesn't.


On Aug 31, 6:01 pm, Kostya Vasilyev <[email protected] <mailto:[email protected]>> wrote:
>   A Service can still get killed ...

> http://developer.android.com/reference/android/app/Service.html#Proce...

>
> -- Kostya
>
> 31.08.2010 20:48, Agus пишет:
>
>
>
> > A thread hosted by the ApplicationContext ...

> > On Tue, Aug 31, 2010 at 9:22 AM, Kostya Vasilyev<[email protected] <mailto:[email protected]>> wrote:

> >> The difference is that Activity lifecycle is managed by the user, and
> >> Service lifecycle ...

--

You received this message because you are subscribed to the Google
Groups "Android Developers" group...



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to