什么时候ServiceConnection.onServiceDisconnected()被调用? [英] When does ServiceConnection.onServiceDisconnected() get called?
问题描述
我搞乱了Android的服务,我发现 ServiceConnection.onServiceConnected()
被称为相当predictably当我绑定到一个服务。
I'm messing with Android services, and I have found that ServiceConnection.onServiceConnected()
gets called fairly predictably when I bind to a service.
不过,我的 onServiceDisconnected()
方法似乎永远不会被调用,虚拟机,甚至死亡后。
However, my onServiceDisconnected()
method seems to never be called, even after the VM dies.
我已经登录服务的调试信息,并显示所有线程都已经关机,等我知道服务实现的过程;有没有线程,我不知道这是$ P $从退出pventing过程?
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?
推荐答案
它发生在远程服务崩溃。因此,如果在不同的进程比客户端上运行的服务上的一些异常失败,你失去了联系,并得到回调。
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.
这篇关于什么时候ServiceConnection.onServiceDisconnected()被调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!