Saturday, August 30, 2014

Update status bar notification

By using NotificationManager.notify(ID, notification) you can update existing notification in notification area. ID refers to existing notification. By using that you can update the content of the notification. notification has to be created by using NotificationCompat.Builder object. If the previous notification has been removed from the notification area, a new notification will be created.

  NotificationManager notificationMgt = (NotificationManager) getSystemService(
                                                     Context.NOTIFICATION_SERVICE);
// Use this id to update exsisting one, to create a new one, use a new ID
  notificationMgt.notify(9999, builder.build());


Refer How to create a simple status bar notification in Android article for more information on notifications.

No comments:

Post a Comment