Faster way to Pass data from C# to Java (Android)

Using AndroidJavaClass.CallStatic("func", new object[] { data } ); I can pass data from Unity to a parent Android Activity… however this is slow.

It currently takes 48ms for every call I send, and I want to be calling 30-60 times per second.
I am sending a large byte
Is there a quicker option?

I have started looking at different JVM Serializers but am not sure if that is the right track?

How does object serialisation work with the AndroidJavaClass? How is the data serialised and sent between languages?

Doing it this way has to use Reflection, which is never going to work if you are calling it every frame. I don’t think the data serialization is your bottleneck.

I think your best bet is to look into pipes. I have never done this on Android, but I have had C# and Java processes communicating through these before and it works well enough. Read this for more info.

You could potentially use a socket, but I would expect that to be slower then pipes (although maybe easier to setup).