0
votes

suppose my application posts a status bar notification with the text "hello". that "hello" notification shows fine in the notification area.
now if my application posts "hello" again while the first "hello" is still in the notification area, the notification area still contains a single "hello" notification, and that's fine too.
But now, if the first "hello" notification is canceled (removed) from the notification area and then the 2nd "hello" notification is posted, i would expect the notification area to show the (2nd) "hello" notification again, but it does not show any "hello" notification.

why is that and how can i get around this problem?

this is what i've done: before posting a notification i always: intent.setAction(""+new Date().getTime()); and i create a content intent as in:

PendingIntent contentIntent = PendingIntent.getActivity(this, 0, flag);

i tried all the following values for 'flag' but none of them solves the problem:
1) PendingIntent.FLAG_ONE_SHOT
2) PendingIntent.FLAG_CANCEL_CURRENT
3) 0

the notification flags are always set to

notification.flags |= 
    Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR;

thanks

1
What's the initial value of notification.flags ? In the above code you're only bitwise or-ing it, not full-on setting it. - dmon

1 Answers

1
votes

I'm guessing your code looks something like the code below:

String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);

<some other code>

private static final int ID = 1;
mNotificationManager.notify(ID, notification);

if so, try changing the 'ID' to be unique for each notification.