tags:

views:

390

answers:

1

I'm messing with Android services, and I have found that ServiceConnection.onServiceConnected() gets called fairly predictably when I bind to a service.

However, my onServiceDisconnected() method seems to never be called, even after the VM dies.

I have logged debug messages on the service and show that all threads have been shutdown, etc. I know services are implemented as processes; are there threads I don't know about that are preventing the process from exiting?

Thanks.

+2  A: 

it happens upon remote service crash. so if a service running in a different process than your client fails on some exception, you loose the connection and get the callback..

Reflog
Is it just on crash? I would expect it to be called when I call `unbindService()` and the service exits because there are no more clients.
sehugg
according to the documentation it only happens on 'unexpected service unbinding' , so yes, it's only on crash, and no on unbindService()
Reflog