Is it possible to move (DocumentsContract.moveDocument(…)) or copy (DocumentsContract.copyDocument(…)) files/documents between different providers?

Viewed 192

I’ve picked 2 document trees (Intent.ACTION_OPEN_DOCUMENT_TREE):

Uri sourceTreeUriApplicationHome[0] = content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fdata%2Fch.becke.sftp_server__s1_v1%2Ffiles/document/primary%3AAndroid%2Fdata%2Fch.becke.sftp_server__s1_v1%2Ffiles

and

Uri destinationTreeUri = content://com.android.providers.downloads.documents/tree/downloads/document/downloads”,

created a new document, and tried to

move: DocumentsContract.moveDocument(getContentResolver(), content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fdata%2Fch.becke.sftp_server__s1_v1%2Ffiles/document/primary%3AAndroid%2Fdata%2Fch.becke.sftp_server__s1_v1%2Ffiles%2FmoveTest_1592578134291.txt, content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fdata%2Fch.becke.sftp_server__s1_v1%2Ffiles/document/primary%3AAndroid%2Fdata%2Fch.becke.sftp_server__s1_v1%2Ffiles, content://com.android.providers.downloads.documents/tree/downloads/document/downloads)”

and to copy: DocumentsContract.copyDocument(getContentResolver(), content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fdata%2Fch.becke.sftp_server__s1_v1%2Ffiles/document/primary%3AAndroid%2Fdata%2Fch.becke.sftp_server__s1_v1%2Ffiles%2FmoveTest_1592694493574.txt, content://com.android.providers.downloads.documents/tree/downloads/document/downloads)

the document but none of these operations worked. Either the returned Uri was null (move operation) or got a UnsupportedOperationException: Copy not supported. Has anyone else experienced the same issue respective could solve this issue? Copying and moving within the same provider works without any issues.

0 Answers
Related