[英]Aidl, android and unbinding service
Could somone explain to me why after calling unbindService i'm still able to communicate with the service ? Somone可以向我解释为什么在调用unbindService之后我仍然可以与该服务进行通信吗?
The flow: 流程:
bindService(new Intent(IService.class.getName()), conn, Context.BIND_AUTO_CREATE)
...
mService = IService.Stub.asInterface(service);
...
writeToOutput("Droping bombs from: " + mService.getPid());
...
unbindService(mCurConnection);
...
writeToOutput("Droping bombs from: " + mService.getPid()); // no exception - still returns good values
...
Perhaps the service is still working on a task. 也许该服务仍在执行任务。
In the google documentation it states that calling unbindService(Connection) simply allows the service to stop at any time. 在google文档中,它指出调用unbindService(Connection)仅允许该服务随时停止。 It does not mention that it is a hard stop or a force stop. 没有提及这是硬停止或强制停止。
From google doc: "Disconnect from an application service. You will no longer receive calls as the service is restarted, and the service is now allowed to stop at any time." 从google doc中获取信息: “与应用程序服务断开连接。重新启动该服务后,您将不再收到呼叫,并且该服务现在可以随时停止。”
Another possibility is that you may have another activity binding to the service and so long as you have at least one bound interface the service stays active. 另一种可能性是,您可能有另一个活动绑定到该服务,并且只要您具有至少一个绑定的接口,该服务就会保持活动状态。
If you would like to post more details about what you are doing, I can probably provide a better solution. 如果您想发布有关您正在做的事情的更多详细信息,我可能会提供更好的解决方案。
Thanks 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.