adryx_92 adryx_92 - 1 year ago 103
Java Question

Read/write external storage on Android

I'm developing an Android application that reads and writes data in a

directory. I get the sdcard path trough the method

I tested the application on a Samsung device where the path returned by the method is
on wich I append
; all works fine and I can r/w files in this folder.
Now I'm trying to do the same on a Nexus device: I have put my files to read in the
directory and the
as path, on wich I append
. But in this case I cannot find the files to read.

I set all the storage permissions in the manifest.

Am I doing something wrong? Is there any particular issue related to an emulated directory?


Answer Source

In Android 6.0, you have to handle certain permissions at runtime. Please go through this. Because READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE are considered as dangerous permissions and has to be handled at runtime.