I don't know how the Oculus SDK integrates with Android, but typically, an Android app has a Java entrypoint to the native code in form of a native method, like this:
public class MyActivity extends Activity {
static {
System.loadLibrary("mylib");
}
public void onCreate() {
super.onCreate();
if (!myInit()) {
// handle the error
}
}
private static native boolean myInit();
}
All the native functions take a pointer to a JNIEnv as first parameter, which can then used to retrieve a pointer to the JVM:
#include <jni.h>
// Do the JNI_OnLoad() dance here, described in the link above
jboolean myInit(JNIEnv *env, jclass clazz) {
(void)clazz;
JavaVM *jvm = NULL;
jint result = GetJavaVM(env, &jvm);
if (result < 0) {
return JNI_FALSE;
}
return JNI_TRUE;
}
Disclaimer: I wrote all code above from top of my head and tested nothing of this. I hope this helps anyway.