Android Service: onBind(Intent) and onUnbind(Intent) is called just once

前端 未结 2 1156
慢半拍i
慢半拍i 2020-12-24 05:38

I have the Activity and the Service. When Activity is started, it calls startService() to make this Service be alive even when Activity is destroyed, and

2条回答
  •  渐次进展
    2020-12-24 06:12

    You can find it here: https://developer.android.com/guide/components/bound-services.html

    You can connect multiple clients to a service simultaneously. However, the system caches the IBinder service communication channel. In other words, the system calls the service's onBind() method to generate the IBinder only when the first client binds. The system then delivers that same IBinder to all additional clients that bind to that same service, without calling onBind() again.

提交回复
热议问题