当前位置:网站首页>AIDL communication
AIDL communication
2022-08-01 21:35:00 【shuo277】
1.1AIDL Introduction
AIDL (Android Interface Definition Language), which can be used to define a programming interface for client-server inter-process communication (IPC).In the Android system, each process runs in an independent memory, completes its own activities in it, and is separated from other processes.But sometimes we have the need for interaction between applications, such as data transfer or task delegation, etc. AIDL was born to meet this need.Through AIDL, data of another process can be obtained in one process and its exposed methods can be called, so as to meet the needs of inter-process communication.
AIDL is a description language used to define the communication interface between the server and the client. It can be used to produce IPC code. In a sense, AIDL is actually a template, because in the process of use, the actual workingIt is not an AIDL file, but an instance code of an Interface produced based on it. AIDL is actually a template that appears to prevent us from repeatedly writing code.
Note: AIDL is only necessary if you need clients from different applications to access the service via IPC, and if you want multithreading in the service.If you don't need to perform concurrent IPC across different applications, you should create the interface by implementing Binder; alternatively, if you want to perform IPC but don't need to deal with multithreading, use Messenger to implement the interface.In any case, it is important that you understand binding services before implementing AIDL.
1.2 Usage process
1. Define the AIDL interface in the .aidl file, add it to the src directory of the application project, rebuild after creation
2. The Android SDK tool will automatically generate the IBinder interface based on the .aidl file. The specific business object implements this interface. This specific business object is also an IBinder object. When binding the service, it will return the specific interface according to the actual situationWho to communicate with (local or proxy)
3. Bind the client to the service, and then you can call the methods in IBinder for inter-process communication (IPC)
1.3 AIDL communication between two APPs
边栏推荐
- Based on php animation peripheral mall management system (php graduation design)
- Classification interface, Taobao classification details API
- WEB 渗透之文件类操作
- 【Unity实战100例】文件压缩Zip和ZIP文件的解压
- Jmeter实战 | 同用户重复并发多次抢红包
- C陷阱与缺陷 第7章 可移植性缺陷 7.8 随机数的大小
- property语法
- shell规范与变量
- 磷酸化甘露糖苷修饰白蛋白纳米粒/卵白蛋白-葡聚糖纳米凝胶的
- C Pitfalls and Defects Chapter 7 Portability Defects 7.11 An Example of a Portability Problem
猜你喜欢
测试开发人均年薪30w+?软件测试工程师如何进阶拿到高薪?
Pagoda application experience
LVS负载均衡群集
Based on php film and television information website management system acquisition (php graduation design)
Based on php Xiangxi tourism website management system acquisition (php graduation design)
Day33 LeetCode
WEB 渗透之文件类操作
左旋氧氟沙星/载纳米雄黄磁性/As2O3磁性Fe3O4/三氧化二砷白蛋白纳米球
An online JVM FullGC made it impossible to sleep all night and completely crashed~
Based on php animation peripheral mall management system (php graduation design)
随机推荐
PyQt5 + MySQL5.8 【学生信息管理系统】【增删改查】
C Expert Programming Chapter 1 C: Through the Fog of Time and Space 1.5 ANSI C Today
C陷阱与缺陷 第7章 可移植性缺陷 7.11 可移植性问题的一个例子
左旋氧氟沙星/载纳米雄黄磁性/As2O3磁性Fe3O4/三氧化二砷白蛋白纳米球
MySQL相关知识
RecycleView的使用
Review Set/Map basics with these two hooks
Shell编程条件语句
C Pitfalls and Defects Chapter 7 Portability Defects 7.11 An Example of a Portability Problem
with语句和上下文管理器
C Pitfalls and Defects Chapter 7 Portability Defects 7.9 Case Conversion
NFT的10种实际用途(NFT系统开发)
Flink cluster construction
方舟开服需要知道的那些事
测试的意义并不是能找到全部的缺陷
How to make the timer not execute when the page is minimized?
Port protocol for WEB penetration
ARFoundation入门教程U2-AR场景截图截屏
render-props和高阶组件
方舟:生存进化官服和私服区别