logoalt Hacker News

tadfisher05/14/20251 replyview on HN

Ongoing 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/d...

[1]: https://developer.android.com/reference/android/content/Cont...


Replies

apitman05/14/2025

> 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.

show 1 reply