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. Big Gmail client Archive/Delete/Older buttons

While I like having quick access to the Archive, Delete, and Older
buttons I feel that they take up too much real estate when in
landscape mode.  I'm wondering if there is any way to make the buttons
'shorter' (taking less vertical space) or to hide them.
Alternatively, it would be nice if they appeared only at the top or
bottom of the message (so that they are contained within the
scrollable portion of the display).

Rob

-- 

2. Is it possible to have a single ui element instance across the application?




You could ...
a) save the state of the control in static data, then with each activity you
have the control in, repopulate it in onCreate() with the static data
b) pass the required state data via intents each time you open a new
activity or return from one.

-------------------------------------------------------------------------------------------------
TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices

-- 

3. Bluetooth Debugging on phones

4. How to zoom in/zoom out to ImageView

5. content provider failes on insert row

6. See when activity is fully rendered?

7. What error message are you getting from your not-yet-whitelisted C2DM application?