Problem Description
I am writing application for Android and use native code, And test it on Android-Emulator. In order to see what happens in JNI code I create file in Android /data/LogTest/ folder and write my log information in it.
FILE * pFile;
pFile = fopen ("/data/LogTest/Log.txt"", "w");
// ....
// Write some logs to file ...
// ....
When I run in the first time Android application everything goes Okay, I can see logs in Log.txt file. But when I close Android application and run it again nothing happening. Like application can’t write Logs to the file second time.
Self Ideas
I think that the main reason of this problem is that, when I create file at first time the creator application Name is for ex. 456 after when I try to write some more information to file application Name is for ex. 856 and so application 856 can’t write to file that have created application 456.
Question
- How I can launch application with same name, in order Android let me to write to file in second time.
- Or maybe the main reason o problem is not that Application every time get rundom names.
I think you are not allowed to write in that folder. Read through the answers here. Either use the sdk card or your application directory to store files.
File Operations in Android NDK