开发者

a notification shows in the notification area only the first time

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜