Access the Download folder from Android 11

Hello,

Following a project carried out with my students, I would like them to be able to download two files via the internet:

  • an .apk file for installing the application
  • a .csv file used by the application (but not created by it)

By default, smartphone downloads go to the Download folder.

Since Android 11, you can no longer access it from the application created.

I would like to avoid manipulations of moving files on the smartphone by the students, and use the application without needing to access the internet.

Is there a "simple" solution to access the .csv file in Donwload?

Thanks

Why the Download folder ?

By default, in Android 11 (if using the web component) files download to the ApplIcation Specific Directory:

/storage/emulated/0/Android/data/<packageName>/files/....

This location is accessible (read/write) for the app.

Hello tantangel

This would be the most sensible solution:

  1. Download and Install the App
  2. App downloads the CSV to it's ASD

Yes, if the CSV is for read only, the App can request READ STORAGE PERMISSION and load the data into the App.

Sorry, I flagged this Topic because it repeats a post in another Topic - However Anke specifically requested Tantangel to create a new Topic.

Thank you for these answers, it will help me.
The file should normally be readable and writable, but I can manage otherwise.

If the CSV file isn't huge, it could be included in the App as an Asset - read from assets, save to ASD, but it would be better if the CSV was downloaded by the App to the ASD.

1 Like

Tantangel - Anke tells me that we cannot even read a CSV from the Download folder @ Android 11+, unless SAF is used - so all the more reason to use the App to download to the ASD.

If the csv file is downloaded by the app (to the Shared folder /Download), it is created by the app.
But if your students change / manipulate this file outside of the app, then this file is no longer created by the app and cannot be accessed (read) by the app (on Android 11+).

So the question is:
Can the manipulations of it be done by the app? If so, there is no problem to access it on all Android versions.

The question of how your students get the APK is another matter. The app can either be downloaded via the Play Store or via another (your own) server.

If the app is not to be distributed via the Play Store, then you can of course also request the special permission MANAGE_EXTERNAL_STORAGE, which grants access to all areas of external storage for all file types (media & non-media files).

I have published an extension for it.

There are only two Shared folders to save non-media files (like .csv):

  1. /Download
  2. /Documents

Note: /Downloads is NOT a Shared folder.

However, you cannot use SAF to access a non-media file from /Download that was not created by the app itself. So the file must be saved in /Documents or some other folder - other than

  • /Download or
  • the root directory of the external storage.

We can thank Google for all this "rubbish". :wink: This constant restriction and paternalism must and will stop.

2 Likes

Thanks for all these leads.