i'm using internaldatapath within nativeactivity when accessed @ runtime looks this:
"/data/data/app.name/files"
i try writing file so:
- fopen("/data/data/app.name/files/test.txt", "wb"); - fwrite(buffer, size, count, m_handle); - fclose(m_handle);
in case, fopen fail , won't open file realistically means other functions don't called, experimented looking @ file system , instead, tried following path.
"/android/data/app.name/files/test.txt"
this works, creates file , allows other functions write , close file.
my question is, how come internaldatapath starts /data/ instead of /android/? have done wrong in setup of application? should calling different function?
it's worth mentioning
externaldatapath = "/storage/emulated/0/android/data/app.name/files"
which means device (which doesn't have external sd) points correct internal files path.
let me know if of unclear or require more information.
thanks
i added mkdir() ensure entire internaldatapath tree created , seems have worked on nexus 7, can see files being created es file explorer.
it works on galaxy s6, can't see files in es file explorer, works because file loaded , read upon next restart can assume can't see file because device not rooted.
it's worth noting between versions of android, internaldata path has changed location, example:
nexus 7 (5.1.1): internaldatapath = /data/data/app.name/files
galaxy s6 (6.0.1): internaldatapath = /data/user/0/app.name/files
these paths absolute, or @ least relative highest view-able root directory in es file explorer.
not sure if anybody, main part of problem own lack of knowledge of android file system since there seems lots of structured directories, it's easy lost down wrong one.
thanks patrik , dave spending time looking me.
Comments
Post a Comment