On Jul 2, 8:39 am, celavek <
cetatzea...@gmail.com> wrote:
> So what would be the best way to create and store those files and where
> would be the
> best "conforming with Android" storage area ?
Since you are talking about small files, probably the internal storage
area associated with the apk in which you are running code.
> Also there seems to be a problem with using from C++ the native activity's
> internalDataPath/externalDataPath pair(a bug that makes them be always
> NULL).
You could call the java getFilesDir() API via jni - realize that even
a native activity still has a dvm in the process to handle interface
with the rest of android.
I have not tested it, but there appears to be an example in this
stackoverflow post:
http://stackoverflow.com/questions/10166638/access-android-apk-asset-data-directly-in-c-without-asset-manager-and-copying
JNIEnv *jni_env = Core::HAZEOS::GetJNIEnv();
jclass cls_Env = jni_env->FindClass("android/app/
NativeActivity");
jmethodID mid_getExtStorage = jni_env->GetMethodID(cls_Env,
"getFilesDir","()Ljava/io/File;");
jobject obj_File = jni_env->CallObjectMethod( gstate->activity-
>clazz, mid_getExtStorage);
jclass cls_File = jni_env->FindClass("java/io/File");
jmethodID mid_getPath = jni_env->GetMethodID(cls_File,
"getPath","()Ljava/lang/String;");
jstring obj_Path = (jstring) jni_env-
>CallObjectMethod(obj_File, mid_getPath);
const char* path = jni_env->GetStringUTFChars(obj_Path, NULL);
/* do something with the string, then */
jni_env->ReleaseStringUTFChars(obj_Path, path);