Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does ServiceConnection.onServiceDisconnected() get called?

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?

like image 942
sehugg Avatar asked Jun 09 '09 18:06

sehugg


People also ask

When onServiceConnected is called?

onServiceConnected. Called when a connection to the Service has been established, with the IBinder of the communication channel to the Service. Note: If the system has started to bind your client app to a service, it's possible that your app will never receive this callback.

What is ServiceConnection?

Service Connection means the pipe, stops, fittings, meter, and meter box laid from the main to the property line of the premises served.


1 Answers

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

like image 53
reflog Avatar answered Sep 24 '22 03:09

reflog