Triggering Notifications

To fire a Notification, pass it in to the notify method on the NotificationManager along with an integer reference ID, as shown in Listing 9-24.

LISTING 9-24: Triggering a Notification Available for downloadon int notificationRef = 1; notificationManager.notify(notificationRef, notification);

To update a Notification that's already been fired, re-trigger it using the Notification Manager, passing the notify method the same reference ID. You can pass in either the same Notification object or an entirely new one. As long as the ID values are the same, the new Notification will be used to replace the status icon and extended status window details.

You also use the reference ID to cancel Notifications by calling the cancel method on the Notification Manager, as shown here:


Canceling a Notification removes its status bar icon and clears it from the extended status window.

Was this article helpful?

0 0
Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide

Post a comment