StartedService和BoundService的区别

来源:互联网 发布:淘宝医疗器械类目 编辑:程序博客网 时间:2024/05/17 01:51

StartedService和BoundService的区别

  • StartedService和BoundService的区别:

    1.StartedService和启动他的Activity不同生共死,BoundService和启动给他的Activity同生共死。
    2.无论是StartedService或者是BoundService,只要service没有被实例化,就都会被Creat。
    3.StartedService每次都回调用onStartCommand(),而BoundService,加入BoundService已经绑定,那么就不再调用onBind()了。

  • PS:

    如果当前进程关闭了,StartedActivity销亡了么?
    Yes!

  • StartedService和BoundService的本质区别

    BoundService其实是一个客户端,服务器端的概念,借助于Binder来通讯。

0 0