Android : Androiod notification set and update

on Saturday, October 11, 2014


I'm setting a notification (which works 100% fine).



int notifyID=5;
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext())
.setSmallIcon("A title")
.setContentTitle("My content words")
.setContentText(R.drawable.whatever);

NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(notifyID, mBuilder.build());


I then start an alarm manager, which goes off, runs my WakefulBroadcastReceiver class where I attempt to update the information in the notification. I don't care if the notification has to flash when it updates or anything, I just want it to update the information.



NotificationManager mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);

NotificationCompat.Builder mNotifyBuilder = new NotificationCompat.Builder(mContext)
.setContentTitle("Any new title")
.setContentText("Any new content");

mNotificationManager.notify(
notifyID,
mNotifyBuilder.build());


Calling this removes the notificaiton


0 comments:

Post a Comment