Android Framework read External Storage file

317 views Asked by At

I would read a file contents from external storage in android frameworks .

File file = new File(archiveFilePath);
if(file == null ) {return false;} 

if(!(file.canRead())){
    Log.e(TAG,"FILE can not have read permissions");
    return false;
}

When I set archiveFilePath to /mnt/sdcard/temp.txt,the program prints "FILE can not have read permissions" log information. But when i set archiveFilePath to /mnt/shell/emulated/0/temp.txt,the program can read file.

It happens in android 4.4.2.

Does anyone know what is happening and why?

0

There are 0 answers