Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In the previous section, we showed how simple it is to create a quick, unobtrusive message to let the user know that some event has happened or to provide them some useful information. In this section, we’re going to look at how to create a persistent notification that not only shows up in the status bar, but stays in a notification area until the user deletes it. To do that, we need to use the classes Notification and NotificationManager.
A notification on Android can be many things, ranging from a pop-up message, to a flashing LED, to a vibration, but all these actions start with and are represented by the Notification class. The Notification class defines how you want to represent a notification to a user. This class has three constructors, one public method, and a number of fields. Table 8.1 summarizes the class.