Summary
In this chapter, we explored the very powerful Service
component, putting it to use to execute long-running background tasks with a configurable level of concurrency.
We learned that running tasks in a Service
gives them the best possible chance of successful completion if the user exits the application, because the system avoids killing processes with active Services unless absolutely necessary.
We discovered various ways to initiate background work in a Service
, from starting the Service
with an Intent
object through to direct method invocation using local Services.
We also saw the wide range of communication mechanisms available for delivering results back to the user: direct invocation of local Service
methods; sending Messages with ...
Get Asynchronous Android 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.