Hello. In general, I'm currently trying to do something like a file manager for Android in a very simple way.

I work with a real device in which there is an internal memory and a memory card.

I get access to the files of the memory card along the path /mnt/sdcard or so Environment.getExternalStorageDirectory().getAbsolutePath()

I get access to device memory files like this /mnt/sdcard2

When I paste the copied file into /mnt/sdcard (External Storage) everything is fine, everything is copied. But when I try to deal with the path starting at /mnt/sdcard2 (internal storage - device memory), I get an IOException open failed: EACCES (Permission denied) .

Manifest permissions:

 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 

My code is:

  private void copy() { try { publishProgress(); if (!newFile.exists()) { if (!isFolder) { newFile.createNewFile(); } } if (isFolder) { FileUtils.copyDirectory(existingFile, newFile); } else { FileUtils.copyFile(existingFile, newFile); } } catch (IOException e) { result = 1; } } 

Can anyone come across such a problem?

0