Deconstructing the Status Bar

Figure 14-1 shows the status bar, the area where you can notify the user of an event. The status bar can hold many icons. The status bar shown in Figure 14-1 holds, starting on the left, a calendar notification announcing an appointment, and an icon signifying that USB debugging is enabled.

Figure 14-1: The status bar, with a couple icons present.

9781118417454-fg1401.eps

Users can also swipe the status bar downward to see more information, as shown in Figure 14-2. Every status bar icon now has an expanded view, where more information can be shown.

Figure 14-2: Opening the status bar.

9781118417454-fg1402.tif

You can inform users of various activities, such as device state, mail notifications, and even download progress, as shown in Figure 14-3.

Figure 14-3: The progress loader on the status bar.

9781118417454-fg1403.tif

Adding an icon to the status bar isn’t your only option for alerting the user to a notification. You can augment a notification using one — or more — of these three options:

check.png Vibration: The device vibrates briefly when a notification is received — useful when the device is in the user’s pocket.

check.png Sound: An alarm sounds when the notification is received. A ringtone or a prerecorded tone that you install along with your application is useful when the user has cranked up the notification sound level.

check.png Light: The LED light on the device flashes at a given interval in the color you specify. (Many devices contain an LED that you can program.) If the LED supports only a single color, such as white, it flashes in that color and ignores your color specification. If the user has set the volume level to silent, the light provides an excellent cue that something needs attention.

Android 4.1 Jelly Bean introduces dramatic improvements to Android notifications. Devices that run Jelly Bean can have notifications with these features:

check.png Expandable preview: The user can expand a notification by using the pinch-and-zoom gesture. The expandable notification is a helpful way to show users an expanded preview of the notification content, such as a message preview for an e-mail application.

check.png Action buttons: A user has always been able to tap a notification to launch the app that created it. However, you can add as many as three additional buttons to a Jelly Bean app to make it perform whatever operations you want. One outstanding example in the Task Reminder app is having the Snooze button temporarily dismiss the notification and bring it back later.

check.png Varied template styles: Jelly Bean ships with three new styles of notifications, as shown in Figure 14-4:

BigTextStyle: Shows a multiline TextView

BigInboxStyle: Shows a list of information

BigPictureStyle: Shows an image

check.png Larger size: Jelly Bean notifications can be as tall as 256 dp.

Figure 14-4: Custom notifications in Jelly Bean.

9781118417454-fg1404.tif

These features aren’t available on older devices, so you can’t use them in versions earlier than 4.1. To give your notifications more impact in Jelly Bean, visit http://developer.android.com/guide/topics/ui/notifiers/notifications.html for more information.

tip.eps Adding various options to your notification arsenal is immensely useful because they let the user know that the device needs attention even when the screen is turned off.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset