When does ServiceConnection.onServiceDisconnected() get called?

自古美人都是妖i 提交于 2019-11-29 16:07:55

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/971824/when-does-serviceconnection-onservicedisconnected-get-called

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!