有两个应用A和B,通过aidl来来共享服务,现在有个问题:
当我想把服务Destroy的时候,为什么要A和B都unbind后,才会Destroy;为什么不是谁create的,就由谁Destroy??????
你们能看懂我说的吗?????
官方文档上写的很清楚,即便你调用了stopService,但系统只会在当前服务的
请求者全部unbind后,才会真正停止这个Service。
public abstract boolean stopService (Intent service)
Since: API Level 1
Request that a given application service be stopped. If the service is not running, nothing happens. Otherwise it is stopped. Note that calls to startService() are not counted -- this stops the service no matter how many times it was started.
Note that if a stopped service still has ServiceConnection objects bound to it with the BIND_AUTO_CREATE set, [color=red]it will not be destroyed until all of these bindings are removed.[/color] See the Service documentation for more details on a service's lifecycle.