The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.


Advanced Notifications

Notifications are those icons that appear in the status bar (or system bar on tablets), typically to alert the user of something that is going on in the background or has completed in the background. Many apps use them, to let the user know of new email messages, calendar reminders, and so on. Foreground services, such as music players, also use notifications, to tell the OS that they are part of the foreground user experience and to let the user rapidly return to the apps to turn the music off.

There are other tricks available with the Notification object beyond those originally discussed in an earlier chapter.

Prerequisites

Understanding this chapter requires that you have read the chapter on basic notifications and the section on RemoteViews in the chapter on basic app widgets.

Being a Good Citizen

Users have a love/hate relationship with apps that use notifications:

And so on.

Users’ discomfort with how apps handle notifications is why Android allows users to disable notifications.

Some of the items in this chapter, particularly those surrounding Android Wear, can help you improve user satisfaction with your notification strategy and tactics. Yet, at the same time, misuse of notifications is magnified by Wear, as Wear takes extra steps to get the user to pay attention to the notifications, with possibly disastrous results for your Play Store reviews.

In short, your objective with notifications is to be a good citizen:

Wear? There!

The preview of this section was accidentally identified as an Android 'tasty treat' by the Cookie Monster.

Stacking Notifications

The preview of this section is out seeking fame and fortune as the Dread Pirate Roberts.

Avoiding Wear

The preview of this section was stepped on by Godzilla.

Other Wear-Specific Notification Options

The preview of this section left for Hollywood to appear in a reality TV show.

Remote Input, On-Device

The preview of this section was last seen in the Bermuda Triangle.

Notification Groups

The preview of this section was abducted by space aliens.

Lockscreen Notifications

The preview of this section is out seeking fame and fortune as the Dread Pirate Roberts.

Priority, and Heads-Up Notifications

The preview of this section was the victim of a MITM ('Martian in the middle') attack.

Full-Screen Notifications

The preview of this section is presently indisposed.

Progress Notifications

The preview of this section was abducted by space aliens.

Custom Views

The preview of this section was the victim of a MITM ('Martian in the middle') attack.

Life After Delete

The preview of this section is en route to Mars.

The Mysterious Case of the Missing Number

The preview of this section is unavailable right now, but if you leave your name and number at the sound of the tone, it might get back to you (BEEEEEEEEEEEEP!).

Notifications and MessagingStyle

The preview of this section was eaten by a grue.

Changes in API Level 23

The preview of this section was lost due to a rupture in the space-time continuum.

Sounds and Android 7.0

The preview of this section may contain nuts.