android bound service,android - Service or Bound Service? - Stack Overflow

I like this explanation:

Started services are easy to program for simple one way interactions

from an activity to a service, however, they require more complex and

ad hoc programming for extended two-way conversations with their

clients.

In contrast, bound services may be a better choice for more

complex two-way interactions between activities and services. For

example, they support two-way conversations.

So, as you said, If you want to interact with the service use bound service. With started services (or intent services) you could do it, only it would require more complex programming.

(by Douglas Schmidt: https://www.youtube.com/watch?v=cRFw7xaZ_Mg (11'10'')):

Here is a summary that helped me understand (thanks Doug):

9ffc32e4da147a5a79d6bdbcef4a392d.png

Started services are launched by other application components (such as an activity or even a broadcast receiver) and potentially run indefinitely in the background until the service is stopped, or is destroyed by the Android runtime system in order to free up resources. A service will continue to run if the application that started it is no longer in the foreground, and even in the event that the component that originally started the service is destroyed

A bound service is similar to a started service with the exception that a started service does not generally return results or permit interaction with the component that launched it. A bound service, on the other hand, allows the launching component to interact with, and receive results from, the service.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值