Reputation: 3
I try to save files on my smartphone. Since I have no SD card installed I must save the data to my internal memory. The user must have easy access to the data later, so I want to store in an easily accessible location. The following variant works without problems but is not easily accessible
File root = new File(getApplicationContext().getFilesDir(),"NAME");
if(!root.exists()) root.mkdirs();
In this variant, I get the message that the access was denied.
Environment.DIRECTORY_DOCUMENTS
I also tried the following permissions:
READ_EXTERNAL_STORAGE WRITE_EXTERNAL_STORAGE
Does anyone know how to access these folders? The root directory would also be enough.
Thanks!
Upvotes: 0
Views: 892
Reputation: 11224
Besides asking for read and write permission in manifest for Android 6+ you should also add code to let the user confirm those permissions.
Google for runtime permissions.
You are #1258 with this problem this year.
Upvotes: 1