[Feature request] Implement DocumentsProvider
As a cloud application, Mega should allow access to files through the Android Storage Access Framework (SAF).
For examples and more info, an open letter to Cloud Storage Apps can be found here: https://medium.com/steadfast-innovation/open-letter-to-cloud-storage-apps-on-android-a2d0eb919fc4
I've already tried to implement a DocumentProvider to Mega following these guides, to make a PR and reduce your workload:
- https://developer.android.com/guide/topics/providers/create-document-provider
- https://medium.com/androiddevelopers/building-a-documentsprovider-f7f2fb38e86a
But I found some difficulties that I was unable to solve (probably because I don't know enough about the structure of the app and the apis):
- Whenever a DocumentsProvider is created,
megaApi.fastLogin()andmegaApi.fetchNodes()must be called, which are blocking tasks and need to be completed before we can respond toqueryRoots(), slowing down operations and failing sometimes - I was unable to get
megaApi.startUnbufferedDownload()to work withParcelFileDescriptor.AutoCloseOutputStream( ParcelFileDescriptor.createReliablePipe()[1] ): download didn't start and remained inSTATE_QUEUED - It appears that
openDocument()is called by SAF multiple times when opening a single document, causing the same download multiple times
This definitely must happen and it has superb benefits. For example, I could choose to backup a KeePass vault and use it on both PC and an Android app without worrying about sync.
KeePass
Totally agree. I was searching if that function was written by some third-party and found this topic.
This is shameful 'bump', but I do not see another way to indicate such thing.
↘️ https://developer.android.com/guide/topics/providers/document-provider#overview ⠀↘️ https://developer.android.com/guide/topics/providers/create-document-provider
I am not sure, but DocumentsProvider also would add an option to refer to a remote resource which might auto-download/upgrade to its latest version on open.
