problem with Notification (PendingIntent)

by Sgom » Fri, 31 Oct 2008 02:43:14 GMT

Sponsored Links
 Hello guys!

I have a problem with notifications (SDK 1.0)

I have wrote an application that, when an event occurs, prepare a
notification and puts it on the status bar.
Each of these notifications should start different instances of the
same Activity (a simple activity that shows some information).
The activity receives with the data to show also the integer value to
use to dismiss the notification that started it.
Let's call this Activity "show".

Here is the problem: let's say i prepare a notification that should
launch my activity "show" with data "first" and put it on the status

Now I prepare a second notification that should launch "show" with
data "second" and put it on the status bar.

The two notifications have different values to be dismissed.

I would like that now, opening the menu containing notifications, if I
click the first notification "show" is launched and shows to the user
"first", then the notification is dismissed. If I click on the second
notification "show" should be launched, display "second", and also
this notification should be dismissed.

Instead what I get is that, independently of which of the two
notifications I click, "show" il launched and displays "first", after
that it dismiss the notification I clicked. If now I click the
remaining notification "show is launched, displays again "first" and
does't dismiss the notification (I must click clear notifications)

I think the problem is to prepare the PendingIntent with some flag,
but I don't know which.
I build the PendingIntent in this way:

PendingIntent myPendingIntent = PendingIntent.getActivity(context,

where context is the context
int is 4 (a random value)
myIntent is the Intent to be used to launch the Activity (it has the

should I use some other flags?