Android11 również umożliwia zapis do dowolnego folderu, jedynie wymaga specjalnego uprawnienia oraz działania użytkownika przed pierwszym użyciem:
- Declare the MANAGE_EXTERNAL_STORAGE permission in the manifest.
- Use the ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION intent action to direct users to a system settings page where they can enable the following option for your app: Allow access to manage all files.
To do this, you would need an extension. Unfortunately, if you want to put your app in the google store with this permission, google will probably reject your app. Special apps such as anti-virus programs, file managers, etc. may have this permission.
More here:
https://developer.android.com/training/data-storage/manage-all-files
Regular apps can write files without any permission in the ASD directory (app specific directory). Unfortunately, it is only suitable for files used only in your app, temporary files, databases, etc. When, for example, your app takes pictures and you want to be able to view these pictures in other programs, and also if you do not want the pictures to be deleted when your deinstall app, it is not a good choice of storage location.
Android 11 also offers the option of saving in other folders, but these are folders predefined for a given file type, for example:
- Images, including photographs and screenshots, which are stored in the DCIM / and Pictures / directories. The system adds these files to the MediaStore.Images table.
- Videos, which are stored in the DCIM /, Movies /, and Pictures / directories. The system adds these files to the MediaStore.Video table.
- Audio files, which are stored in the Alarms /, Audiobooks /, Music /, Notifications /, Podcasts /, and Ringtones / directories, as well as audio playlists that are in the Music / or Movies / directories. The system adds these files to the MediaStore.Audio table.
- Downloaded files, which are stored in the Download / directory. On devices that run Android 10 (API level 29) and higher, these files are stored in the MediaStore.Downloads table. This table isn't available on Android 9 (API level 28) and lower.
More here:
https://developer.android.com/training/data-storage/shared/media
and here:
https://developer.android.com/training/data-storage/shared/documents-files
Ai2 is not yet api level 30 targeted, so it does not yet include the appropriate tools for saving files for android 11. We have to wait until the end of summer to see what MIT comes up with. If this is not enough for the users, I think there will be appropriate extensions to save files in all ways.