If they are the same intent, they can not be uniquely distinguished, so the
more recent one replaces the previous.

It's like doing:

HashMap<String, Foo> alarms;

Foo foo1 = new Foo();
Foo foo2 = new Foo();

alarms.put("mything", foo1);
alarms.put("mything", foo2);

The second call replaces the value of the first.

On Tue, Jul 13, 2010 at 8:04 PM, Satya Komatineni <
[email protected]> wrote:

> It was a bit baffling (Probably there is a good reason, and it doesnt
> take much to baffle me)
>
> AlarmManager am;
> ...
> PendingIntent pi;
>
>
> am.set(pi, ...) at 11pm
> am.set(pi,...) at 2pm
>
> Same "pending intent" with the same intent and  request code, in
> otherwords they resolve to same intent on equals.
>
> Although I know what happens (being the latest one takes precedence),
> I would have expected my broadcast receiver to be called twice.
>
> I thought something funny is happening in the PendingIntent.
>
> However when I looked at the AlarmManagerService.java I have noticed
> that the "set.." methods are calling a "remove" using the
> PendingIntent that is passed in, essentially cancelling the one
> before.
>
> Why is that??
>
> It is late, my head hurts, I am hoping someone will throw some light.
>
> Thanks a bunch
> Satya
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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

Reply via email to