Nathan wrote:
> Let's say I have a background service that performs several tasks.
> 
> As it completes task A, it posts notification A with a certain intent
> and some extra data that indicates viewing result of A.
> As it completes task B, it posts notification B with a certain intent
> and some extra data that indicates viewing result of B.
> As it completes task C, it posts notification C with a certain intent
> and some extra data that indicates viewing result of C.
> 
> At the end, the notification area has three notifications. Each one
> has the same intent, except for one of the extra data fields.
> I would expect that each one would load my activity with different
> extra data. They don't.

PendingIntent.getActivity() will return a unique PendingIntent object
*only* if the Intent you supply to that call is materially different
than those used by other outstanding PendingIntents. By "materially
different", I mean where Intent#filterEquals() returns false.

In your case, your three Intents are all the same from the perspective
of filterEquals(), because filterEquals() does not take extras into account.

Hence, you need to make three more distinct Intents.

If your intents right now are using the component (e.g., new
Intent(this, SomeActivity.class)), the easy way to do this is to assign
some unique action string to them. That won't affect how the Intent gets
routed, but it will make it distinct from a filterEquals() standpoint.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Online Training: 21-25 June 2010: http://onlc.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to