2 ms·
Open the Drive app, tap the "New" button, and select "Upload". You get a file picker UI. This UI is provided by the Storage Access Framework that Nextcloud says
by tadfisher 1y ago
Open the Drive app, tap the "New" button, and select "Upload". You get a file picker UI. This UI is provided by the Storage Access Framework that Nextcloud says they cannot use.
- Macha 1y agoThis is not the same functionality that Nextcloud provides though. This is one time upload of manually selected files, not ongoing passive sync of an entire directory tree.
- tadfisher 1y agoOngoing sync is still possible through ACTION_OPEN_DOCUMENT_TREE [0], and using ContentResolver.takePersistableUriPermission [1] to maintain long-lived access to that directory. Enumerating files is slow but that is not a major concern when the use-case is a background sync, and you can drop down to ContentResolver APIs to reduce the number of IPC calls when enumerating. [0]: https://developer.android.com/training/data-storage/shared/documents-files#grant-access-directory https://developer.android.com/training/data-storage/shared/d... [1]: https://developer.android.com/reference/android/content/ContentResolver#takePersistableUriPermission(android.net.Uri,%20int) https://developer.android.com/reference/android/content/Cont...
- apitman 1y ago> Enumerating files is slow but that is not a major concern when the use-case is a background sync Slow means it's probably burning a lot of CPU, and that is a problem for background tasks, especially on mobile.
- tadfisher 1y agoNo, the call is going through ContentProvider, which happens over Binder IPC, which entails context switching and other I/O overhead. Compared to local file operations (java.io and friends) this is massive; compared to anything else your device does, it's not a big deal at all, and it's not CPU-bound.
- izacus 1y agoThe same picker has the functionality of allowing access to a full directory.
- apitman 1y agoThat's just the Drive app. The system overall certainly has more capabilities than are made available to developers[0]. [0]: https://support.google.com/googleone/answer/9149304?hl=en&co=GENIE.Platform%3DAndroid https://support.google.com/googleone/answer/9149304?hl=en&co...
- tadfisher 1y agoYes, but Nextcloud is adamant that they need MANAGE_EXTERNAL_STORAGE permission, not access to the device backup system API.