Skip to content
Advertisement

Android-How to create a new writeable file?

I have a jobIntentService that create a file to add some text in it but I get the error /data/user/0/com.example.projet/files/log.txt (Is a directory). I don’t know what I did wrong… Here is my code :

JavaScript

Furthermore, what I want is a sort of log file so I want to access it from the phone but /data/user/0/com.example.projet/files/log.txt is an hidden path to the user… I already tried Environment.getDataDirectory() but I don’t have the permission even if they are in the manifest…

Edit : Here is my manifest permissions :

JavaScript

Thanks for your help !

Advertisement

Answer

With all the comment of you guys this work so there is the final code :

JavaScript

Thanks !

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement