Background operations noticeable to the user – using a Foreground Service
With our SCA all suited up, they are now ready to get to the assigned destination. To track the SCA, we will periodically poll the location of the SCA using a Foreground Service and update the sticky notification (a notification that cannot be dismissed by the user) attached to that service with the new location.
Note
For the sake of simplicity, we will fake the location. Following what you learned in Chapter 7, Android Permissions and Google Maps, you could later replace this implementation with a real one that uses a map.
Foreground services are another way of performing background operations. The name may be a bit counterintuitive. It is meant to differentiate these services from the base Android (background) services. The former are tied to a notification, while the latter run in the background with no user-facing representation built in.
Another important difference between foreground...