<p style="color: rgb(51, 51, 51); font-family: tahoma, 宋体; font-size: 14px; line-height: 22.3999996185303px; text-align: justify; background-color: rgb(250, 250, 252);">AIDL(Android Interface Definition Language)是Android接口定义语言的意思,它可以用于让某个Service与多个应用程序组件之间进行跨进程通信,从而可以实现多个应用程序共享同一个Service的功能。</p><p style="color: rgb(51, 51, 51); font-family: tahoma, 宋体; font-size: 14px; line-height: 22.3999996185303px; text-align: justify; background-color: rgb(250, 250, 252);">言归正传,今天的主题是远程Service建立AIDL进行通信,通过一个小demo来展示AIDL在Android studio中的实现:</p><p style="color: rgb(51, 51, 51); font-family: tahoma, 宋体; font-size: 14px; line-height: 22.3999996185303px; text-align: justify; background-color: rgb(250, 250, 252);">1. 搭建了一个简单的Service框架,仅包括startService(intent),框架在后面代码中展示出来</p><p style="color: rgb(51, 51, 51); font-family: tahoma, 宋体; font-size: 14px; line-height: 22.3999996185303px; text-align: justify; background-color: rgb(250, 250, 252);">2. 然后建立AIDL,通过点击建立AIDL文件,如图</p><p style="color: rgb(51, 51, 51); font-family: tahoma, 宋体; font-size: 14px; line-height: 22.3999996185303px; text-align: justify; background-color: rgb(250, 250, 252);"><img src="http://www.linuxidc.com/upload/2015_01/150102163841371.png" alt="" width="581" vspace="5" style="border: 0px; margin-left: auto; display: block; margin-right: auto; cursor: pointer;" /></p><p style="color: rgb(51, 51, 51); font-family: tahoma, 宋体; font-size: 14px; line-height: 22.3999996185303px; text-align: justify; background-color: rgb(250, 250, 252);">建立好之后,出现AIDL文件如图</p><p style="color: rgb(51, 51, 51); font-family: tahoma, 宋体; font-size: 14px; line-height: 22.3999996185303px; text-align: center; background-color: