Unity Android + NDK(C++) + JNI(Java)

Hey,

I’m trying to make my own JNI calls from C++ instead of Unity.
(So I can get callbacks sent from Java to Unity, without using SendMessage)

The problem is, it seems that while the Java methods doing they’re calculations(after I called them from c++ and the java worked properly), the JNI call from c++ crush and with it all the unity app.
When I’m calling the same JNI call straight from Unity, all works fine.

I think that a little time after the c++ JNI call, the c++ is closed and with it the JNI environment.

Did someone try to do this?
Anyone has a solution?

Thanks

It seems that the problem was, that Java can’t get unity pointer as java object.
So I store the methods in the c++ files in a map, and pass both the java code and the c++ code an ID for the methods.

Hi people.

I create a plugin that helps with interaction between Java and C#. You can listen for system messages with broadcast receivers, and pick images from gallery using StartActivityForResult/OnActivityResult methods.
This is the link for Asset Store: Android System for Unity.
Let me know if it attend your needs.

Thanks.