Android AIDL

119 阅读1分钟
/**
 * 1、在 service 端,创建 AIDL 接口定义文件
 * 2、build 项目
 * 3、创建 Service 服务, 在 onBind 中,返回 MyBind() `class MyBind : IMyAidlInterface.Stub()`
 * 4、在 client 端 创建 Aidl Folder, 创建同 Service 同 aidl 文件的包名。
 * 5、在 ServiceConnection 中 Interface.Stub.asInterface(service) 拿到定义的 aidl 接口,在回调中处理结果
 * 6、在 client 中 bindService ,与  ServiceConnection 连接。
 */