Alerting Users via Notifications
Pop-up messages, tray icons and their associated “bubble” messages, bouncing dock icons…you are no doubt used to programs trying to get your attention, sometimes for good reason. Your phone also probably chirps at you for more than just incoming calls: low battery, alarm clocks, appointment notifications, incoming text and e-mail messages, and so on.
Not surprisingly, Android has a whole framework for dealing with these sorts of things, collectively called notifications, as described in this chapter.
A service, running in the background, needs a way to let users know something of interest has occurred, such as when e-mail has been received. Moreover, the service may need ...