local service and remote service(AIDL Service)

来源:互联网 发布:jr史密斯在cba数据 编辑:程序博客网 时间:2024/06/03 13:49
1.Unlike the  AsyncTask  we covered earlier, a  Service  object does not create its own 
threads automatically.
2. A local service is a service that does not support  onBind()—it 
returns  null from  onBind(). This type of service is accessible only to t he components of 
the application that is hosting the service. You call local services by calling 

startService().  

3.On the other hand, an AIDL service is a service that can be consumed both by 

components within the same process and by thos e that exist in other applications. This 
type of service defines a contract between itself and its clients in an AIDL file. The 
service implements the AIDL contract, and clients bind to  the AIDL definition. The 
service implements the contract  by returning an implementation of the AIDL interface 
from the  onBind() method. Clients bind to an AIDL service by calling  bindService() , and 
they disconnect from the service by calling  unbindService() . 
原创粉丝点击