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

The user can switch away from an Activity at any time, and, since Android isn't aware that there is a worker thread, it can kill the process that hosted the Activity (and the worker thread) pretty soon after that.

A Service is a way to tell Android you're doing something important in the background, and so the process has a higher chance to be kept alive (and your worker thread working).

-- Kostya

31.08.2010 20:05, cool.manish пишет:
Service Component is used to do some task which can be done without
user interaction. But for that we have to run a thread in subclass of
the Service.
I think we can create a thread in Activity class itself then what is
the use of Service component?
Why don't we create another thread and write the non interacting code
in this thread.



--
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