Created
August 16, 2017 13:04
-
-
Save yageek/a105973cc2446cff9e27e61dfb7fba21 to your computer and use it in GitHub Desktop.
Android VM Settup (Qt inpired)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static JavaVM * m_android_vm = nullptr; | |
extern "C" | |
jint JNICALL JNI_OnLoad(JavaVM *vm, void *) { | |
__android_log_print(ANDROID_LOG_DEBUG, "TestBluetooth", "JNI LOAD"); | |
static bool initialised = false; | |
if (initialised) { | |
return initialised; | |
} | |
initialised = true; | |
m_android_vm = nullptr; | |
typedef union { | |
JNIEnv *nativeEnvironment; | |
void *venv; | |
} UnionJNIEnvToVoid; | |
UnionJNIEnvToVoid venv; | |
JNIEnv *nativeEnvironment = nullptr; | |
if(vm->GetEnv(&venv.venv, JNI_VERSION_1_4) != JNI_OK){ | |
__android_log_print(ANDROID_LOG_FATAL, "TestBluetooth", "GetEnv failed"); | |
return -1; | |
} | |
return JNI_VERSION_1_6; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment