*.so
文件,我想获取已安装的软件包列表,但我没有上下文指针thiz point
但只有env pointer
,我该怎么办?
这意味着我只有jnienv pointer
,但我想在系统中获取已安装的apks列表...我该怎么做?
Java_com_kings0527_JNIGetCert_JNIGetCert_stringFromJNI( JNIEnv* env,
jobject thiz )
{
jclass activityClass = (*env)->FindClass(env, "android/app/Activity");
jmethodID getPackageManagerMid = (*env)->GetMethodID(env, activityClass, "getPackageManager", "()Landroid/content/pm/PackageManager;");
jobject packageManagerObject = (*env)->CallObjectMethod(env, thiz, getPackageManagerMid);
我需要活动上下文。(jobject thiz)
谁可以分享您的想法?非常感谢你!