See: Description
Annotation Type | Description |
---|---|
NullableType |
Marks which of the types in a type parameter are nullable
|
Oneway |
Marks a method call as asynchronous one way call
|
ParamIn |
Marks a parameter as an input only type.
|
ParamOut |
Marks a parameter as an output only type.
|
Remoter |
Marks an interface as a Remote interface.
|
Remoter is an alternative to Android AIDL for Android Remote IPC services using plain java interfaces.
//Remoter annotation marks this interface as a remoter service interface
@Remoter
public interface ISampleService {
//An example where parameters can be in, out or inout
void boolean foo( boolean a,
@ParamIn boolean[] arrayIn,
@ParamOut boolean[] arrayOut,
boolean[] arrayInOut);
//An example to mark a method as oneway asynchronous method
@Oneway
void asynchronusFoo(int x);
}
At the client side :
Simply wrap the binder that you got from the ServiceConnection with the autogenerated Proxy for your interface
ISampleService sampleService = new ISampleService_Proxy( binder );
At the service side :
Wrap the implementation with the autogenerated Stub to covert it as a remote Binder and return that from your service
Binder binder = new ISampleService_Stub( sampleServiceImpl );
To add Remoter to your project add these to its gradle dependencies:
api 'com.josesamuel:remoter-annotations:1.1.4'
annotationProcessor 'com.josesamuel:remoter:1.1.4'