Receiving broadcast null in application shutdown

by Semeria Stefano » Tue, 13 May 2008 10:27:50 GMT


Sponsored Links
 ello,

My application is using a mocked location provider and an intent receiver to
receive updates.
During shutdown I first stop the location updates with
LocationManager.removeUpdates(), then I deregister the intent receiver.

I randomly receive the following error:

I/jade.util.Logger( 1101): com.tilab.msn.LocationReceiver: onReceiveIntent
called: My currentThread has this ID: 1 -> Intent receiver has called
I/jade.util.Logger( 1101): com.tilab.msn.ContactListActivity: onStop called ...
I/jade.util.Logger( 1101): com.tilab.msn.GeoNavigator: Stopping location
updates.... -> Here updates should be stopped!
D/LocationManager( 1101): removeUpdates: intent = Intent {
action=com.tilab.msn.LOCATION_UPDATE }
D/LocationManagerService( 508): removeUpdate: intent = Intent {
action=com.tilab.msn.LOCATION_UPDATE }
D/LocationManagerService( 508): loadProviders
D/LocationManagerService( 508): loadProviders: already loaded
I/jade.util.Logger( 1101): com.tilab.msn.ContactListActivity: onDestroy called
...
I/jade.util.Logger( 1101): com.tilab.msn.GeoNavigator: Unregistering the intent
receiver.... -> Here I deregister the intent receiver
I/jade.util.Logger( 1101): jade.android.MicroRuntimeService: Initiating
Stopping JADE...
I/jade.util.Logger( 1101): jade.core.FrontEndContainer: Container shut down
activated
I/jade.util.Logger( 1101): com.tilab.msn.MsnAgent: Starting agent takeDown()
I/jade.util.Logger( 1101): com.tilab.msn.MsnAgent: DS Subscription Canceling
message was sent!
I/jade.util.Logger( 1101): com.tilab.msn.MsnAgent: Deregistering from DF!
D/jade.util.Logger( 1101): jade.core.FrontEndContainer: Local agents terminated
I/jade.util.Logger( 1101): jade.imtp.leap.JICP.BIFEDispatcher: Sending
termination notification
D/jade.util.Logger( 1101): jade.core.FrontEndContainer: Connection manager
closed
I/jade.util.Logger( 1101): jade.android.MicroRuntimeService: JADE should be
stopped now! Microruntime.shutdownJADE() ends!
D/jade.util.Logger( 1101): jade.android.JadeGateway: disconnect():
disconnecting from service
W/ActivityManager( 508): Unbind failed: could not find connection for [EMAIL
PROTECTED]
I/jade.util.Logger( 1101): com.tilab.msn.LocationReceiver: onReceiveIntent
called: My currentThread has this ID: 1 -> Intent receiver has called again!!!
I/jade.util.Logger( 1101): com.tilab.msn.LocationReceiver: onReceiveIntent
called: My currentThread has this ID: 1
I/jade.util.Logger( 1101): com.tilab.msn.LocationReceiver: onReceiveIntent
called: My currentThread has this ID: 1
W/ActivityManager( 508): finishReceiver called but no pending broadcasts
D/dalvikvm( 1101): Exception Ljava/lang/RuntimeException; from
ActivityThread.java:492 not caught locally
D/dalvikvm( 1101): Exception Ljava/lang/RuntimeException; from
ZygoteInit.java:1553 not caught locally
D/AndroidRuntime( 1101): Shutting down VM
W/dalvikvm( 1101): threadid=3: thread exiting with uncaught exception
(group=0x4000fdf8)
E/AndroidRuntime( 1101): Uncaught handler: thread Main exiting due to uncaught
exception
E/AndroidRuntime( 1101): java.lang.RuntimeException: Error receiving broadcast
null in [EMAIL PROTECTED]
...

It seems that the service that stops the updates is not doing it synchronously,
so updates continues for a while after the LocationManager.removeUpdates() call
returns. If this is the right behavior, I guess that I should wait before
deregistering the intent receiv



Receiving broadcast null in application shutdown

by Megha Joshi » Wed, 14 May 2008 18:26:59 GMT


 i Stefano,

This seems like a bug. Could you please log this with enough details in the
android issue tracker?

This has been discussed earlier in the thread below:
http://groups.google.com/group/android-developers/browse_thread/thread/d03f0db6004345a1/35346fa13547133f

Thanks,
Megha

On Tue, May 13, 2008 at 3:27 AM, Semeria Stefano <
[EMAIL PROTECTED]> wrote:


--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Receiving broadcast null in application shutdown

by geekchique » Wed, 14 May 2008 20:15:53 GMT


  would love to hear any work arounds for this I have been struggling
with this for an age without realising its a bug!


On May 13, 10:27am, Semeria Stefano
<[EMAIL PROTECTED]> wrote:
--~--~---------~--~----~------------~-------~--~----~



Receiving broadcast null in application shutdown

by Mark Murphy » Wed, 14 May 2008 20:36:01 GMT


 > I would love to hear any work arounds for this I have been struggling

With M5, I haven't run into this bug, but it may be that my usage of
location updates differs from the ones that are getting the bug.

I get the updates in an activity (vs. a service). I turn off updates in
onPause() and resume them in onResume(), since in my case I don't need the
updates if the activity isn't visible.

I turn off updates using:

myLocationManager.removeUpdates(myIntent);
unregisterReceiver(intentReceiver);

where intentReceiver and myIntent are instance variables in the activity
itself.

It may be that I'm "immune" to the bug in that the time gap between
onPause() and my activity being destroyed is too long to trigger the bug.
Near as I can tell from the referenced thread, the issue is that the
IntentReceiver is no longer around when the last update or two get sent;
in my case, my IntentReceiver probably is around long enough to get those
last updates.

So, as far as a workaround, try to keep your IntentReceiver around after
disabling updates. This may mean disabling updates earlier than you are
doing now, or it may be your IntentReceiver is somehow going out of scope
and is getting garbage collected earlier than is necessary.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
The Busy Coder's Guide to Android Development -- coming in June 2008!


--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. wrong example in dev guide - audio capture

hi.

below link contains a example code of audio capture
http://developer.android.com/guide/topics/media/index.html#capture

my problem is..
"MediaStore.MediaColumns" class don't have TIMESTAMP constant.
see also, 
http://developer.android.com/reference/android/provider/MediaStore.MediaColumns.html

i'd like to audio capture.
any suggestion?

thanks.

-- 

2. Current consensus on whether to use Copy Protect mode when publishing in Market?

Good question, would love to hear the answer myself.

-- 

3. How to overwrite the default background of List Item in A ListView when the List Item has focus

4. Xperia x10 iklan

5. Wifi - Unable to scan for networks

6. UncaughtExceptionHandler not called ?

7. Motorola Droid / Milestone projector