Sounds like you are thinking backwards in terms of when things
happen.

Lets say I unregistered the receiver, but have not made the
removeUpdates call. The location manager does not know this, and still
sends out an update. Being that there are no more registered receivers
for that update, it can't do anything but complain.

However, if have only made the removeUpdates call, no more updates are
sent. The receiver just sits there doing nothing at this point.

Actually, in your original code, I could see it working part of the
time. If removeUpdates were to get called before the location manager
fired another update, not having a receiver registered wouldn't
matter.

On Apr 5, 3:56 pm, Jakob Bjerre Jensen <[EMAIL PROTECTED]>
wrote:
> Hello Dan,
>
> Thanks for your answer, which seems to solve the problem. However to
> me the logical order is
> first to call unregisterReceiver(ir) (saying this specific ir instance
> is no more interested in notifications),
> then calling removeUpdates() (saying skip all notifications to me).
>
> Is that the correct interpretation/semantics of the calls?
>
> Could you please tell me, why the other order of calls work?
>
> I don't feel confident unless there is an explanation to this (which I
> hope there is).
>
> Best regards,
> Jakob Bjerre Jensen
>
> On 5 Apr., 22:02, "Dan U." <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > If I have some time, I'll look into it more, but for now, have you
> > tried to reverse the order of these calls:
>
> > activity.unregisterReceiver(ir);
> > locationManager.removeUpdates(new Intent("test"));
>
> > On Apr 5, 3:20 am,JakobBjerreJensen<[EMAIL PROTECTED]>
> > wrote:
>
> > > Hello,
>
> > > I have an IntentReceiver IR, which I register as follows:
>
> > > locationManager.requestUpdates(..., new Intent("test"));
> > > IntentFilter filter = new IntentFilter();
> > > filter.addAction("test");
> > > IR ir = new IR(...);
> > > activity.registerReceiver(ir, filter);
>
> > > This works excellent. However doing my unregistration as follows:
>
> > > activity.unregisterReceiver(ir);   // ir = same concreate class instance
> > > as above
> > > locationManager.removeUpdates(new Intent("test"));
>
> > > still seems to produce broadcasts, which results in an error with message
> > > "Error receiving broadcast null in IR".
>
> > > What is wrong with my unregistration code, and what is the correct way?
>
> > > Also, should'nt it be enough just to call
> > > locationManager.removeUpdates(new Intent("test"))? Basically this
> > > says: "Don't inform me of any kind of broadcast from that location
> > > manager anymore".
>
> > > Best regards,
> > >JakobBjerreJensen- Skjul tekst i anførselstegn -
>
> > - Vis tekst i anførselstegn -
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to