Skip to content

Filesystem access #454

Description

@CampelloManuel

We have to find a way to keep SD sync and json backup working.
This issue details all problems related to filesystem access

For android API >= 29 the File API used everywhere in this app does not work: we can't save backups in Downloads/ , it says "file not found". But in Android/data/.../ it works.
For android API < 29 it works but needs the WRITE_EXTERNAL_STORAGE permission.

The recommended solution is to replace file access with DocumentFile, using the Storage Access Framework and the system's built-in filepicker. Already finished for the json backups, but the org files will keep using the File API: the code uses File objects instead of URIs, so enabling this is just too much work.

We use an hardcoded folder, /storage/emulated/0/Android/data/packagename/files for ORG files.

  • That folder is the least likely to cause problems
  • no need to change most app code
  • Users can stil manually move and edit org files with their file manager app
  • if someone needs the content of those ORG files we can add an on-demand export function or an android content provider to query the note data
  • easier to use, no folder to choose

An attempt was made to use the MediaStore API, but it was too unreliable and discomfortable to use.
Interested readers can look for MediaStoreHelper in #455
Where the File API is blocked by Google, we use the Storage Access Framework

Metadata

Metadata

Labels

questionNeither a bug or a feature request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions