O'Reilly logo

Android Application Development For Dummies, 2nd Edition by Donn Felker, Michael Burton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Updating a Notification

At some point, you might need to update the view of your notification, such as when your code runs in the background, to see whether tasks have been reviewed. This code checks to see whether any notifications are overdue. Suppose that after the 2-hour mark passes, you want to change the icon of the notification to a red exclamation point and quickly flash the LED in red. Thankfully, updating the notification is a fairly simple process.

If you call the notify() method again with an ID that’s already active on the status bar, the notification is updated on the status bar. Therefore, to update the notification, you simply create a new Notification object with the same ID and text (but with a different red icon) and then call notify() again to update the notification.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required