Android Improved Notifications
Android Jelly bean came with new and improved notifications, with new APIs so developers can make better use of this vital area of the user interface.
The first thing you’ll notice with Jelly Bean notifications are they have now increased in size. Not only does that make them infinitely more readable, but in the case of built-in apps like Gmail, you can now get a quick preview of incoming emails as they come in.
Where supported, dragging up on a notification with two fingers collapses it to a single row, while doing the reverse expands it. In the case of Calendar events, users can even act upon information, such as snoozing an alarm or emailing invited guests. Likewise, incoming missed calls can be returned quickly thanks to a handy callback button, or photos can be shared with ease right after being taken.
Here is the small API description for latest Notifications…
The new method setStyle () allows you to specify one of three new styles for your notification that each offer a larger content region. To specify the style for your large content region, pass setStyle () one of the following objects:
• Notification.BigPictureStyle: For notifications that includes a large image attachment.
• Notification.BigTextStyle: For notifications that includes a lot of text, such as a single email.
• Notification.InboxStyle: For notifications that include a list of strings, such as snippets from multiple emails.
There’s now support for up to two action buttons that appear at the bottom of the notification message, whether your notification uses the normal or larger style. To add an action button, call addAction (). This method takes three arguments: a drawable resource for an icon, text for the button, and a PendingIntent that defines the action to perform.
You can now hint to the system how important your notification is to affect the order of your notification in the list by setting the priority with setPriority (). You can pass this one of five different priority levels defined by PRIORITY_* constants in the Notification class. The default is PRIORITY_DEFAULT, and there are two levels higher and two levels lower.
High priority notifications are things that users generally want to respond to quickly, such as a new instant message, text message, or impending event reminder. Low priority notifications are things like expired calendar events or app promotions.