jclass android_content_Context =env->GetObjectClass(activity);
jmethodID midGetPackageName = env->GetMethodID(android_content_Context,
"getPackageName", "()Ljava/lang/String;");jstring packageName= (jstring)env->CallObjectMethod(activity, midGetPackageName);
}
Hi,I would like to replace my use of hard-coded package names in findClass() method calls from within my JNI library, with non hard-coded paths .. "somehow".The trouble is: how do I get the package name for the currently running app which is using my library, from within the JNI?
JNIEXPORT jboolean JNICALL Java_com_example_package_ClassName_nativeGetPackageName(JNIEnv* env, jobject this, jobject activity)
{
...
}