当前位置:网站首页>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

边栏推荐
猜你喜欢

WEB 渗透之文件类操作

基于php酒店在线预定管理系统获取(php毕业设计)

在Cesium中实现与CAD的DWG图叠加显示分析

基于php动漫周边商城管理系统(php毕业设计)

CS-NP白蛋白包覆壳聚糖纳米颗粒/人血清白蛋白-磷酸钙纳米颗粒无机复合材料

数字图像处理 第十二章——目标识别

作业8.1 孤儿进程与僵尸进程

基于php在线音乐网站管理系统获取(php毕业设计)

牛血清白蛋白刺槐豆胶壳聚糖缓释纳米微球/多西紫杉醇的纳米微球DTX-DHA-BSA-NPs

FusionGAN:A generative adversarial network for infrared and visible image fusion article study notes
随机推荐
方舟生存进化是什么游戏?好不好玩
JSD-2204-Knife4j框架-处理响应结果-Day07
C陷阱与缺陷 第7章 可移植性缺陷 7.11 可移植性问题的一个例子
【中文树库标记---CTB】
pytest:开始使用
Pytest: begin to use
小程序--独立分包&分包预下载
Based on php film and television information website management system acquisition (php graduation design)
Graph adjacency matrix storage
JSD - 2204 - Knife4j framework - processing - Day07 response results
淘宝获取收货地址列表的 API
包含吲哚菁绿的多聚体白蛋白纳米球/载马钱子碱纳米粒的牛血清白蛋白微球的制备
ISC2022 HackingClub白帽峰会倒计时1天!最全议程正式公布!元宇宙集结,精彩绝伦!
365天挑战LeetCode1000题——Day 046 生成每种字符都是奇数个的字符串 + 两数相加 + 有效的括号
Flink集群搭建
图像融合GANMcC学习笔记
Based on php online learning platform management system acquisition (php graduation design)
TP5-NPs负载噻吩类化合物TP5白蛋白纳米粒/阿魏酸钠新糖牛血清蛋白纳米粒
软考 ----- UML设计与分析(上)
Shell编程条件语句