Summary

In this chapter, we explored the very powerful Service component, putting it to use to execute long-running background tasks with or without a configurable level of concurrency.

We explored the incredibly useful IntentService—an ideal construct for performing long-running background tasks off the main thread, surviving well beyond the lifecycle of the initiating Activity, and even continuing to do useful work when the application is no longer in the foreground.

We learned how to send work to an IntentService with parameterized Intents, how to process that work in the background by implementing onHandleIntent, and how to send results back to the originating Activity using a PendingIntent.

For cases where the application is no longer in the ...

Get Asynchronous Android Programming - Second Edition 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.