| 516 | } |
| 517 | |
| 518 | jstring JNIHelper::GetExternalFilesDirJString(JNIEnv* env) { |
| 519 | if (activity_ == NULL) { |
| 520 | LOGI( |
| 521 | "JNIHelper has not been initialized. Call init() to initialize the " |
| 522 | "helper"); |
| 523 | return NULL; |
| 524 | } |
| 525 | |
| 526 | jstring obj_Path = nullptr; |
| 527 | // Invoking getExternalFilesDir() java API |
| 528 | jclass cls_Env = env->FindClass(NATIVEACTIVITY_CLASS_NAME); |
| 529 | jmethodID mid = env->GetMethodID(cls_Env, "getExternalFilesDir", |
| 530 | "(Ljava/lang/String;)Ljava/io/File;"); |
| 531 | jobject obj_File = env->CallObjectMethod(activity_->clazz, mid, NULL); |
| 532 | if (obj_File) { |
| 533 | jclass cls_File = env->FindClass("java/io/File"); |
| 534 | jmethodID mid_getPath = |
| 535 | env->GetMethodID(cls_File, "getPath", "()Ljava/lang/String;"); |
| 536 | obj_Path = (jstring)env->CallObjectMethod(obj_File, mid_getPath); |
| 537 | } |
| 538 | return obj_Path; |
| 539 | } |
| 540 | |
| 541 | void JNIHelper::DeleteObject(jobject obj) { |
| 542 | if (obj == NULL) { |
nothing calls this directly
no test coverage detected