aidl

“In/out/inout” in a AIDL interface parameter value?

元气小坏坏 提交于 2019-11-30 10:30:58
问题 I'm programming a radio streaming app. I run the "radio playing" as a remote Service by using AIDL interface technique to communicate with the Service. But I don't really understand one thing. What is the "out" in a AIDL interface parameter value? Like this: String doSomething(in String a, out String[] b); I understand "in", that is sending data to the remote when the method is called from activity. What is the "out", and why we need "in" and "out" in same method? In which case are they("out

AIDL interface can't find import for Parcelable class

一世执手 提交于 2019-11-30 08:53:11
问题 My issue seems to be similar to this question and this one but it is a bit different. I am making an AIDL service that is in a Library project and using it in my application. I have a class Vehicle that is in my application that I have made parcelable so that I can use it in my interface. (I would like to get a List of vehicles from my service that is in the library to my application) Do I need a Vehicle.java in both the application and the library? Do I need a Vehicle.aidl in both? I had

Does oneway declaration in Android .aidl guarantee that method will be called in a separate thread?

╄→гoц情女王★ 提交于 2019-11-30 00:57:59
I am designing a framework for a client/server application for Android phones. I am fairly new to both Java and Android (but not new to programming in general, or threaded programming in particular). Sometimes my server and client will be in the same process, and sometimes they will be in different processes, depending on the exact use case. The client and server interfaces look something like the following: IServer.aidl: package com.my.application; interface IServer { /** * Register client callback object */ void registerCallback( in IClient callbackObject ); /** * Do something and report

IPC的6种方式

孤人 提交于 2019-11-29 22:24:40
IPC是Inter-Process Communication的缩写,意为进程间通信或者跨进程通信,是指两个进程进行数据交换的过程。下面就介绍一下IPC 的几种方式: 1.Bundle 这种方式使用的是比较多的,也是很常见的。四大组件中的三大组件(Activity,BroadcaseReceiver,Service)都是支持在Intent中传递Bundle数据的,由于Bundle实现了Parcelable接口,所以可以很方便的在不同进程间传输。这里就不再赘述了。 2.使用文件共享 共享文件也是一种不错的进程间通信方式,两个进程通过读/写同一个文件来交换数据。这里也不再赘述。但有一点要注意:android系统是基于Linux的,使得其并发读/写文件可以没限制地进行,甚至两线程同时对同一文件进行写操作都是允许的,尽管这可能出问题。So,重点: 文件共享方式适合在对数据同步要求不高的进程间进行通信,并且要妥善处理并发读/写问题。 3.Messenger Messenger译为信使,顾名思义,主要作用就是传递消息。通过它可在不同进程中传递Message对象,在Message中放入要传递的数据,即可轻松地实现数据的进程间传递了。Messenger是一种轻量级的IPC方案,底层实现是AIDL。Messenger的使用方法很简单,他对AIDL做了封装,使得我们更简单的进行进程间通信。

Adnroid利用AIDL实现Service间的双向通信

杀马特。学长 韩版系。学妹 提交于 2019-11-29 22:17:00
网上相当多关于android利用AIDL实现进程间通信文章,基本上都是activity去bind一个service,然后调用客户端,也就是activity这边调用服务端的方法。但我心里一直有个疑问,这种模式是单向的,如何实现AIDL的双向通信?于是跑了下面的Demo。 大致原理是两个Service,Service1和Service2,Service1bind好Service2后,拿到Service2的Binder对象,在本地转成AIDL对象,然后通过这个AIDL对象再传递一个AIDL对象到Serivce2,传过来的这个AIDL的“根”Stub,就是接口的实现,是在Service1这边,这样Service2通过接口可以调用Service1的方法。 下面是代码: 两个AIDL接口的定义: // IMyAidlInterface.aidl package com.acxingyun.servicecomunication; import com.acxingyun.servicecomunication.IRegistAidl; // Declare any non-default types here with import statements //传递AIDL接口到对端,需要在文件开始import这个AIDL文件 interface IMyAidlInterface { void

“In/out/inout” in a AIDL interface parameter value?

空扰寡人 提交于 2019-11-29 20:17:38
I'm programming a radio streaming app. I run the "radio playing" as a remote Service by using AIDL interface technique to communicate with the Service. But I don't really understand one thing. What is the "out" in a AIDL interface parameter value? Like this: String doSomething(in String a, out String[] b); I understand "in", that is sending data to the remote when the method is called from activity. What is the "out", and why we need "in" and "out" in same method? In which case are they("out/inout") used? Why is the String[] "out"? Please help.. In AIDL , the out tag specifies an output-only

How can I use AIDL remote service to deal with defferent clients' concurrent requests?

╄→гoц情女王★ 提交于 2019-11-29 11:23:12
I'm writting a plug-in which defines a remote Service and provides a AIDL interface for 3rd party developers. How can I use this remote service to deal with defferent clients' concurrent requests? It is that service apk's activitys can keep status for each client, when they switched between each other, how to do it? This can be achieved using HandlerThread with Looper which maintains and service all the request no matter received from 100 applications. For this AIDL callback interface is also needs to be added as request will be furnished through these callbacks. SERVER APP IAidlService.aidl

AIDL入门

旧街凉风 提交于 2019-11-29 10:48:54
1.用途 Android系统中的进程之间不能共享内存,因此,需要提供一些机制在不同进程之间进行数据通信。 为了使其他的应用程序也可以访问本应用程序提供的服务,Android系统采用了RPC方式来实现。与很多其他的基于RPC的解决方案一样,Android使用一种接口定义语言IDL来公开服务的接口。我们知道4个Android应用程序组件中的3个(Activity、BroadcastReceiver和ContentProvider)都可以进行跨进程访问,另外一个Android应用程序组件Service同样可以。因此,可以将这种可以跨进程访问的服务称为AIDL服务。 2.名词 AIDL(Android Interface Definition Language):Android接口定义语言 IDL( Interface Definition Language ): 接口定义语言 RPC(Remote Procedure Call):远程过程调用 IPC( Inter-Process Communication):进程间通信 3.使用AIDL步骤 1.Create the .aidl file This file defines the programming interface with method signatures. 2.Implement the interface The

Android进阶AIDL使用自定义类型

天大地大妈咪最大 提交于 2019-11-29 09:15:27
原文首发于微信公众号:jzman-blog 上篇文章 中主要介绍从 AIDL 的使用方式以及 Android 开发中不同进程之间的通信,遗留的问题是如何在 AIDL 中使用自定义类型,具体步骤如下: 创建自定义类型 声明自定义类型 定义与自定义类型相关的业务 重写业务实体类 远程调用 验证 AIDL 1. 创建自定义类型 自定义类型传输的就是一个实体对象,这个实体类必须实现 Parcelable 接口,具体如下: // 自定义类型 public class Work implements Parcelable { private String title; private String content; // getter、setter、Parcelable 省略 } 2. 声明自定义类型 创建一个 .aidl 文件声明刚才定义的类型,注意与具体业务 .aidl 文件的不同,声明具体如下: // 在.aidl文件中声明自定义类型 package com.manu.aidldemo; parcelable Work; 3. 定义与自定义类型相关的业务 在定义具体业务的 .aidl 文件中定义与自定义类型相关的业务,具体如下: // Declare any non-default types here with import statements import com.manu

AIDL interface can't find import for Parcelable class

五迷三道 提交于 2019-11-29 09:01:20
My issue seems to be similar to this question and this one but it is a bit different. I am making an AIDL service that is in a Library project and using it in my application. I have a class Vehicle that is in my application that I have made parcelable so that I can use it in my interface. (I would like to get a List of vehicles from my service that is in the library to my application) Do I need a Vehicle.java in both the application and the library? Do I need a Vehicle.aidl in both? I had Vehicle.java AND Vehicle.aidl in both application and library and I began running into a problem in my