6. The Way of the Service
Services are one of the most important, and often under-utilized, components of the Android platform. They are essential for accomplishing any task whose data or relevance can span more than one activity. They are like activities in that they have a lifecycle (albeit a much simpler one), but they do not have the activity’s ability to draw to the screen. In practice, services break down into two major use cases: the listener and the task. Listeners are services that hang out in the background, waiting for something to happen that prompts them to take action. Task services are akin to the photo downloader that we covered before, so in this chapter I’ll focus on listening services.
What Is a Service?
A Service
is, at its ...
Get Creating Android Applications: Develop and Design 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.