spacecowboy / NotePad

Now under new management
GNU General Public License v3.0
384 stars 157 forks source link

Filesystem access #454

Closed CampelloManuel closed 1 year ago

CampelloManuel commented 1 year ago

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.

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

CampelloManuel commented 1 year ago

If you want to ask something related to saving/reading files in this app, feel free to use this thread.

I'll close the issue since I have no intention of working on this in the near future. I tested backups and org files sync and they work on the devices I use.