How to access non-media & media files on Android 11+

Access to non-media files on Android 11+

On Android 11+, non-media files (like txt, pdf, csv, ...) can be accessed
if and only if

  1. the text files are in the → ASD or in the → Private dir (i.e. were saved there), or
  2. the text files are in one of the Shared folders /Documents or /Download and
    these files were created by the app itself, or
  3. SAF is used, or
  4. MANAGE_EXTERNAL_STORAGE* permission is requested and granted.

*` This is not really an option, because an app that requests this permission will (most likely) not be allowed in Google's Play Store.

Note: Of course, all files in the assets can be read. However these are read only.

Access to media files on Android 11+

Without READ permission, media files (like jpg, png, mp3, mp4, ...) can be read on Android 11+
if and only if

  1. these files are located in one of the Shared folders (/Pictures, /DCIM, /Documents, /Download, /Music, /Movies) and were created by the app itself, or
  2. these are in the ASD or
  3. these are in the Private directory.

With READ permission, all media files can be read from all areas of the external storage (also from the root dir).

Without WRITE permission, media files can be saved on Android 11+
if and only if

  1. these are stored in the ASD or
  2. these are stored in Private dir or
  3. these are stored in one of the Shared folders.

The Private directory is in the internal storage:

/data/user/0/<packageName>/files/

Note: Since WRITE_EXTERNAL_STORAGE permission no longer exists on Android 11+, without MANAGE_EXTERNAL_STORAGE there is no way to save files outside of the ASD, Private dir or Shared folders. Or you must use SAF.

For more details see also here:

11 Likes

Dear Anke,

Thank you so much for your reply, I tried different paths for the file and now it is finally working.
I'm very thankful for your help, I would not have been able to solve it without you and all your device.

Thank you so much!! This app should help to name the photos for bat roosts. So you actually made a contribution to bat conservation :wink:

2 Likes

So if you use MANAGE_EXTERNAL_STORAGE while uploading app to play store it is asking for details. why we are using this functionality to for usage of MANAGE_EXTERNAL_STORAGE. What to mention there i am using this permission for pdf files getting. can you anyone specify some details for using this permission.

Hello,

I saw that the /Download folder could only be accessed if the file had been created from the application.
Here is my problem:
My application must be able to be downloaded to be installed, and use a .csv file created separately.
It will be students who will do the manipulations, and I can't ask them to go to the folders and move the .csv file to the right place (which will be different from one phone to another), everything would have to be automatique.
Is there a solution?

Save the CSV in the ASD (App Specific Directory) instead. If the CSV is a download, you can use Anke's extension version 2:

... by whom, the app or is the student creating this file outside of the app?

... within / through the app?

I create the .csv file, students must download it before using the application.

By default, the download is done in the /Download folder of the smartphone, and having the students move it will be very complicated, it seems to me.

So the CSV file is downloaded via the app?
If so, then why move it to another location?

Students will need to upload two files:

  • the .apk to install the application
  • the .csv that the application can use it

or download ?

@tantangel I think we're leaving the topic here.
So open a new topic and ask your questions there precisely.

yes, sorry...

A post was merged into an existing topic: [Free] File Picker Extension - Pick File From Storage (2.1.6)