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 an SMS message has arrived. In this next section we are 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 class Notification since we want to do something more complex than Toast can offer us.
A notification on Android can be many things, ranging from a pop-up message, a flashing LED, to a vibration, but all of 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 and has three constructors, one public method, and a number of fields. Table 8.1 summarizes the class.