For the More Curious: Service Details

We recommend using IntentService for most service tasks. If the IntentService pattern does not suit your architecture, though, you will need to understand more about services to implement your own. Prepare for an infobomb, though – there are a lot of details and ins and outs to using services.

What service does (and does not) do

A service is an application component that provides lifecycle callbacks, just like an activity. Those callbacks are even performed on the main UI thread for you, just like in an activity.

A service does not run any code on a background thread out of the box. This is the #1 reason we recommend IntentService. Most non-trivial services will require a background thread of some kind, ...

Get Android Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.