aidl service also called across process service, or remote service, unlike local service , aidl service across the process, can supply service for other application.

the below describe how to implement an aidl service.

the server side:

1. write the aidl file to define the interface that the service can supply. we use myService for example, and the aidl file is myService.aidl

2. write a service implement the myService.stub(means the interface which defined as myService.aidl), and return new myService.stub reference in onBind of the service.

3. add intent in AndroidManifest.xml to open the service for the client use.

the client side:

1. bind service.

use bindService(intent, ServiceConnection, flag) for bind service . when bindService() be involked , the onBind() method of the service will be called. you should return myService.stub reference in onBind() method.

you can hold a myService reference in ServiceConnection, assume the reference ismService, then the mService represent the implement of the myService.stub, every process to mService is to the implement of the myService.stub. so you can use the service do what you want.

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. 基于开源CMDB系统快速实现一棵服务树
  2. Python-web验证码的实现
  3. 政务大数据系列7:政务大数据的部署结构
  4. Python将一个数逆序列放入列表中
  5. 玩转可迭代对象迭代器生成器
  6. 《大数据架构详解:从数据获取到深度学习》
  7. 后起之秀go语言你了解吗?助你年薪30W+
  8. 企业实战|Mysql不停机维护主从同步
  9. 算法基础7:平衡查找树概述
  10. 政务大数据系列6:政务大数据的物理模型