guich wrote:
> Thanks. But i'm still not sure that a Service really runs in the
> background. :-) Does it?

That depends on what you mean by "background".

If you mean "does it have a GUI?", then yes, services run in the background.

If you mean "does it run on its own thread", then it depends.

Service's callbacks (onCreate(), onStart(), etc.) are all called on the
main application thread. Service, by itself, does not start any other
threads, so that is up to you.

IntentService does manage a background thread on your behalf, routing
each Intent sent to startService() to the background thread, which then
calls your implementation's onHandleIntent() on that background thread.
It will automatically stop that thread and the service itself when there
is no more work to be done (i.e., all Intents passed to startService()
have been processed by onHandleIntent()).

WakefulIntentService is a class I put together to help you use an
IntentService that is waking up the device (e.g., by AlarmManager), so
it will keep the device awake as long as there is work to be done.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.3 Available!

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