-1

I know that READ_EXTERNAL_STORAGE is needed to read files outside app storage, but how about folders. The official documentation (https://developer.android.com/reference/android/Manifest.permission#READ_EXTERNAL_STORAGE) isn't very clear and other sources online are not helpful either. Do I have to check this permission before I check if some specific folder exists and what subfolders does it have?

aleskva
  • 1,644
  • 2
  • 21
  • 40
  • Did you read this link? https://developer.android.com/training/data-storage – tyczj Mar 12 '21 at 21:15
  • For checking if a folder exists you often do not need permissions. To list folders you need permissions on devices below Android 11. But... You can check this all so easily yourself. – blackapps Mar 12 '21 at 21:22
  • Yes, I read that a few times. There is nothing about reading external folders, just about reading external files. – aleskva Mar 12 '21 at 21:29
  • I only talked about exists and list. Not about read. – blackapps Mar 12 '21 at 21:30
  • Well my main interest is to check if folder exists and what subfolders does it contain, but I don't mind more thorough answer about if READ_EXTERNAL_STORAGE is needed for additional info (origin date, change date, visibility). I don't want to avoid asking for the permission, I just want to make sure I ask just before it is really needed. – aleskva Mar 12 '21 at 21:37
  • "You can check this all so easily yourself." Where could I read more about this? – aleskva Mar 12 '21 at 21:48
  • No not read. Just try it out yourself was the advice. – blackapps Mar 12 '21 at 22:09

1 Answers1

0

As @blackapps suggested, checking if any folder exists works always without permission on API 23 device. Listing contents (subfolders) is more complicated:

  • root and its subfolders (/): works without permissions
  • user storage root and its subfolders (/storage/emulated/0, /sotrage/sdcard1, ...): needs permission

Still I'd like to know more universal answer.

aleskva
  • 1,644
  • 2
  • 21
  • 40