Services, WorkManager, and Notifications
In the previous chapter, we learned how to request permissions from the user and use Google’s Maps API. With that knowledge, we obtained the user’s location and allowed them to deploy an agent on a local map. In this chapter, we will learn how to track a long-running process and report its progress to the user.
Ongoing background tasks are quite common in the mobile world. Background tasks run even when an application is not active. Examples of long-running background tasks include the downloading of files, resource clean-up jobs, playing music, and tracking the user’s location.
This chapter will introduce you to the concepts of managing long-running tasks in the background of an app. We will cover the two primary mechanisms that Android provides for managing such tasks: services and workers. Services are application components designed to run in the background, even when an app is not running. They have no user...