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条)

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮