Android AIDL[Android Interface Definition Language]跨进程通信


全称与中文名
IPC:Inter-Process Communication(进程间通信)
Ashmem:Anonymous Shared Memory(匿名共享内存)
Binder:Binder(进程间通信机制)
AIDL:Android Interface Definition Language(android接口定义语言)
Intent:Intent(意图)

基本概念
IPC:一种概念,即进程间通信
Ashmem:作用之一是通过Binder进程间通信机制来实现进程间的内存共享
Binder:对IPC的具体实行,是IPC的一种具体实现
AIDL:Binder机制向外提供的接口,目的是为了方便调用Binder
Intent:最高层级的封装,实质上封装了对Binder的使用

使用场景:

AIDL          IPC             多个应用程序     多线程
Binder       只有IPC      没有多线程         多个应用程序
Messenger     只有IPC      没有多线程


AIDL案例:

1.定义AIDL文件
2.实现服务端
3.实现客户端

2.实现服务端


 

3.实现客户端


原文地址:https://www.cnblogs.com/cyqx/p/11005686.html