一,AIDL详情
AIDL是一种定义接口语言,用于多个应用间使用同一个Service的功能。
相比其他跨线程通信:Broadcast Receiver,它的优势是:性能稳定,效率高,而且系统上实现共享内存。
二,AIDL的使用:
通常使用它需要启动Client端和Service端
Service端创建
1,先创建AIDL
2,修改aidl文件,并 Rebuild
interface IMyAidlInterface {
//传入int数据,返回string 数据
String getstring(int data);
}
3,创建service
public class MyService extends Service {
public MyService() {
}
@Override
public IBinder onBind(Intent intent) {
return iMyAidlInterface;