26static jboolean
jniInit(JNIEnv* env, jobject thiz)
28 qCDebug(AndroidInitLog) << Q_FUNC_INFO;
30#ifdef QGC_GST_STREAMING
31 const jclass contextClass = env->GetObjectClass(thiz);
36 const jmethodID getClassLoaderId = env->GetMethodID(contextClass,
"getClassLoader",
"()Ljava/lang/ClassLoader;");
37 if (QJniEnvironment::checkAndClearExceptions(env)) {
38 env->DeleteLocalRef(contextClass);
42 const jobject classLoader = env->CallObjectMethod(thiz, getClassLoaderId);
43 if (QJniEnvironment::checkAndClearExceptions(env)) {
44 env->DeleteLocalRef(contextClass);
49 env->DeleteGlobalRef(_class_loader);
50 _class_loader =
nullptr;
52 _class_loader = env->NewGlobalRef(classLoader);
53 env->DeleteLocalRef(classLoader);
54 env->DeleteLocalRef(contextClass);
65 qCDebug(AndroidInitLog) << Q_FUNC_INFO;
67 const JNINativeMethod javaMethods[]{{
"nativeInit",
"()Z",
reinterpret_cast<void*
>(
jniInit)}};
71 qCWarning(AndroidInitLog) <<
"Failed to register native methods for"
76 qCDebug(AndroidInitLog) <<
"Main Native Functions Registered";