josesamuel / remoter Goto Github PK
View Code? Open in Web Editor NEWRemoter - An alternative to Android AIDL for Android Remote IPC services using plain java interfaces
License: Apache License 2.0
Remoter - An alternative to Android AIDL for Android Remote IPC services using plain java interfaces
License: Apache License 2.0
Hi! Great library.
Just encountered this issue when using remoter for a kotlin interface. I included the library using a kapt annotation processor:
implementation 'com.josesamuel:remoter-annotations:1.2.4'
kapt 'com.josesamuel:remoter:1.2.4'
The annotation processor runs correctly and generates my proxy and stub, but at compile time throws the error package org.parceler does not exist
whenever the generated stub tries to call org.parceler.Parcels.wrap()
.
Adding the following to my build.gradle works around the issue, but shouldn't Parceler be a transitive dependency?
implementation 'org.parceler:parceler-api:1.1.12'
kapt 'org.parceler:parceler:1.1.12'
Lets assume we two apps, one acts as Server and the other acts as Client for a IPC Oneway call.
Now the Client performs a Oneway IPC call which includes a callback to the Server. The Server tries to process the request and suddenly produces a unchecked exception (OutOfMemory...). The Remoter Framework is now swallowing the unchecked Exception and the Client still waits for the callback to be called.
Unchecked exception in case of a IPC oneway call should be thrown which leads to the death of the App.
We had a OutOfMemory on the Server side and remoter was the cause that Android wasn't restarting our App because the OutOfMemory wasn't propagated any further. Instead the App got stuck in a unusable state.
Is it possible to access the AIDL file that remoter generates from my kotlin interface?
I would like to have access to it so that I can feed it into the Xamarin Android AIDL compiler so that I can have the service be implemented in C#.
Hi, not sure if you have time to add ability to pass flags to ServiceConnector#connectWithService()
Android 14 will introduce BIND_ALLOW_ACTIVITY_STARTS and caller will need to add BIND_ALLOW_ACTIVITY_STARTS flag to context.bindService() when binding to a service on another app.
I have a multiplatform project (desktop and android) with a hierarchy of modules.
at the base is a plain Java library written in Kotlin. (:businesslogic
)
It contains an interface definition. (IBusinessLogic
)
I then have an android library module that depends on this .jar
, (:businesslogic:android
) where I need to create a remoter host service and a client for this interface.
I can add com.josesamuel:remoter-annotations
to the Java Library module (:businesslogic
) and annotate the interface, but since it is a pure java library with no Android dependency (it produces a .jar
, not an .aar
) I cannot add com.josesamuel:remoter-builder
and have a remoter stub
or proxy
generated in that module.
I would like to keep the interface defined in the Java module (:businesslogic
) so as to have all the business logic separate from the android platform.
would it be possible to add some kind of mechanism to have the remoter-builder
generate an implementation for the interface (IBusinessLogic
) in the android module? (:businesslogic:android
) while keeping the interface in the java module? Perhaps this could apply to any interface, not just ones that are marked with @Remoter
?
perhaps something like the marker you have in your suspender
library?
@GenerateRemoterFor(classesToWrap = [
IBusinessLogic::class,
IThirdPartyLibraryInterface::class
])
interface XXX
Thanks for this implementation.
is there sample client app code?
Parcelize itself does not generate an accessible CREATOR or writeToParcel in kotlin. For the CREATOR, technically you can create a java helper method to access the CREATOR accessible from the java side, however, I need to look further into the writeToParcel side.
Hi, awesome plugin, but unfortunately it's not working with @parcelize, as far as I know, there is an issue with CREATOR field. (https://youtrack.jetbrains.com/issue/KT-19853/Parcelize-CREATOR-field-should-be-available-from-code)
And I receive errors in my project _Stub.kt:260:57 Unresolved reference: CREATOR
Possible solution would be using kotlinx.parcelize#parcelableCreator<T : Parcelable>
according to the link provided above.
Hi came across an issues. I am testing your library for communication between 2 different apps and at one point I have added extra methods to my listener on de server app and notice the crash because client app had the old version of the listener.
I cannot seem to find how to get instance of each listener as _stub and set setStubProxyCheck(false) on them.
As in your examples I have registerListener(listener: IRemoteServiceListener) Remoter interface implementation.
Where would get access to instance of IRemoteServiceListener_Stub?
Hi, thank you for great work. I was wondering how one would go about having 2 apps communicating with your library.
You samples seems to show only within communication within app on a different process.
I am trying to have 2 apps, signed with same signature one as server and another as client communication with remoter.
Is it possible at all?
Dear @josesamuel,
Thank you for this great library !
I've faced to some build issue with remoter code generation while trying to create some remote interface inheriting some generic interface.
Here is a trivial code example bringing out the issue:
package example;
import java.util.List;
public interface GenericInterface<T extends List<?>> {
void onNext(T list);
}
package example;
import java.util.ArrayList;
import remoter.annotations.Remoter;
@Remoter
public interface RemoteInterface extends GenericInterface<ArrayList<?>> {
}
Trying to compile those to files results in following error in generated RemoteInterface_Proxy.java:
error: cannot find symbol
public void onNext(T list_0) {
^
symbol: class T
location: class RemoteInterface_Proxy
It looks like the T
generic parameter is not replaced with ArrayList<?>
in Proxy class.
I've specified an upper bounded-type List<?>
to simplify the example but actually in my real code the upper bounded-type is a remoter interface. This means that I would expect the generated proxy code to deal with this and work with binder in the remote procedure onNext
rather than trying to serialize the input parameter.
I'm not familiar with java annotation processor but I can try to give a hand to fix this, if needed.
Best Regards,
Hi, my solution uses multiples users on android and I have an AIDL server running on the owner user where the other users access it, I found this library and it would be perfect for new architecture that I'm implementing, but to access a service on another user is necessary bindAdminDeviceServiceAsUser, is it possible to ultiliza somehow? Or have any other suggestions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.