llller 2011-10-26 22:28
浏览 203
已采纳

关于aidl的问题???????

有两个应用A和B,通过aidl来来共享服务,现在有个问题:
当我想把服务Destroy的时候,为什么要A和B都unbind后,才会Destroy;为什么不是谁create的,就由谁Destroy??????

你们能看懂我说的吗?????

  • 写回答

2条回答 默认 最新

  • 李文栋 2011-11-01 18:03
    关注

    官方文档上写的很清楚,即便你调用了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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog