sdlAndroidGetJniEnv function

Pointer<NativeType> sdlAndroidGetJniEnv()

Get the Android Java Native Interface Environment of the current thread.

This is the JNIEnv one needs to access the Java virtual machine from native code, and is needed for many Android APIs to be usable from C.

The prototype of the function in SDL's code actually declare a void* return type, even if the implementation returns a pointer to a JNIEnv. The rationale being that the SDL headers can avoid including jni.h.

\returns a pointer to Java native interface object (JNIEnv) to which the current thread is attached, or 0 on error.

\since This function is available since SDL 2.0.0.

\sa SDL_AndroidGetActivity

extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void)

Implementation

Pointer<NativeType> sdlAndroidGetJniEnv() {
  final sdlAndroidGetJniEnvLookupFunction = libSdl2.lookupFunction<
      Pointer<NativeType> Function(),
      Pointer<NativeType> Function()>('SDL_AndroidGetJNIEnv');
  return sdlAndroidGetJniEnvLookupFunction();
}