josesamuel / remoter

Remoter - An alternative to Android AIDL for Android Remote IPC services using plain java interfaces
Apache License 2.0
84 stars 14 forks source link

How to call setStubProxyCheck on a listener. #12

Closed NLLAPPS closed 2 years ago

NLLAPPS commented 2 years ago

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?

josesamuel commented 2 years ago

Why would you want to disable that check? You need to build both the server/client with the same interface

NLLAPPS commented 2 years ago

I will be using your library on a client/server app config. One or the other might be an old version and would not have the same interface version.

josesamuel commented 2 years ago

As long as you are not calling the method that is not in the other side, it should be ok.

If you are calling such a method, then regardless of whether that check is there or not, it will fail at some level.

NLLAPPS commented 2 years ago

It may be possible to call non existing method as apps will not be aware of their versions. For now I am using try catch but would loved to know if setStubProxyCheck(false) can be called with some sort of cast.

josesamuel commented 2 years ago

If this is the interface that you returned in your service's onBind call, then you already have the Stub that you wrapped it with.

If this was an interface that you passed to the other end as a parameter or return, then currently the stub that wraps it is not currently exposed.

regardless, calling setStubProxyCheck(false) won't help.

NLLAPPS commented 2 years ago

Thank you