-
Book Overview & Buying
-
Table Of Contents
Asynchronous Android Programming - Second Edition
By :
In the previous chapters we focused our attention on the basic, high-level, Android-specific constructs to load data asynchronously on an independent line of execution (background thread); android.os.AsyncTask and android.content.Loader.
What if we want to provide a common set of operations that implement any kind of business logic over a centralized single entity that could be re-used by different clients and has a lifecycle that is not bound to the client lifecycle? By clients, in Android, we mean any kind of UI entity, such as an Activity or Fragment object, a BroadcastReceiver, or any kind of object that wants to exercise business logic.
The solution for this pattern in Android is available in the form of android.app.Service.
In Android, the Service programming pattern, well-known in enterprise architectures, does not necessarily mean background work, so to avoid any kind of responsiveness degradation in the UI we should try keep the main...