android aidl service
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.
更多相关文章
- 代码中设置drawableleft
- android 3.0 隐藏 系统标题栏
- Android开发中activity切换动画的实现
- Android(安卓)学习 笔记_05. 文件下载
- Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
- 技术博客汇总
- android 2.3 wifi (一)
- AndRoid Notification的清空和修改
- Android中的Chronometer