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..
The oneway keyword modifies the behavior of remote calls. When used, a remote call does not block; it simply sends the transaction data and immediately returns. The implementation of the interface eventually receives this as a regular call from the Binder thread pool as a normal remote call.
The Android Interface Definition Language (AIDL) is similar to other IDLs you might have worked with. It allows you to define the programming interface that both the client and service agree upon in order to communicate with each other using interprocess communication (IPC).
all native Java data types like int,long, char and Boolean.
In AIDL, the out
tag specifies an output-only parameter. In other words, it's a parameter that contains no interesting data on input, but will be filled with data during the method.
For example, a method that copies an array of bytes might be specified like this:
void copyArray(in byte[] source, out byte[] dest);
The inout
tag indicates that the parameter has meaning on both input and output. For example:
void charsToUpper(inout char[] chars);
This is important because the contents of every parameter must be marshalled (serialized, transmitted, received, and deserialized). The in/out tags allow the Binder to skip the marshalling step for better performance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With