You can think of a bound service as the server in a client-server style application. The user sees the activity—the user interface—while the service provides back-end processing. By default, a bound service only runs as long as its bound activity stays alive. When the activity the service is bound to shuts down, the service becomes unavailable. It might not be completely destroyed right away, but it’s no longer accessible to the application and is eligible to be shut down by the app framework.
- [Instructor] I've described how to use Intent services…to run operations in the background and in many cases…this is a great type of service to use for tasks…that have a distinct starting and ending state.…There are other kinds of operations, though, that need…services that survive for longer than a single task,…and that brings us to bound services.…You can think of a bound service as a server…in a client server style application.…The user sees the activity, the user interface,…while the service provides backend processing,…and because the service stays alive,…it can maintain its own state.…
By default, a bound service only runs as long as its…bound activity or fragment stays alive.…When the activity the service is bound to shuts down,…the service is no longer available.…It might not be completely destroyed right away…by the system, but it's no longer accessible…to the application, and it's eligible…for being shut down and destroyed.…It's important to note that starting with Android 5.0,…the JobScheduler API took over many of…
First, discover how to create and start simple background threads, and how to use handlers to manage a thread's message queue. Then, learn various methods for optimizing the scheduling and performance of background tasks in Android with AsyncTask, intent services, and the JobScheduler API. Plus, explore tools that help you implement multithreading for different tasks in Android: Loader, for asynchronous data loading, and the open-source API Retrofit, for making HTTP requests.
Note: To get the most out of this course, you should be comfortable programming with Java, and should understand the most basic skills that are needed to build Android apps with the Android SDK and Android Studio.
- Creating and running a background thread
- Sending messages to the UI from threads
- Managing multiple background threads
- Managing threads with AsyncTask
- Managing long-running tasks with services
- Scheduling background tasks with JobScheduler
- Using other APIs for concurrent programming