问题
Can a third party app request a Storage provider through Storage Access Framework to grant it with premissions to delete files within\copy files to a directory or in any subtree underneath the tree Uri
recieved onActivityResult
by a call to startActivityForResult(new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE),14)
?
If it can, how do you claim it on the third party app code?
I tried
getContentResolver().takePersistableUriPermission(treeUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
but when i try to delete a file in the subtree i get :
Permission Denial: reading com.android.externalstorage.ExternalStorageProvider uri content://com.android.externalstorage.documents/tree/0403-0201%3ADCIM%2Fthai2%2FDSC_0024.JPG from pid=26781, uid=10749 requires android.permission.MANAGE_DOCUMENTS, or grantUriPermission()
EDIT : To explain my use case and maybe get other suggestions for it, I am developing an app that helps users manage photos they have on their device, if its by helping arrange them in albums or delete them fast and easy. That means that without premissions to manage files in the SD card it becomes almost useless (at least for me, as i got SD of 64gb with a nice amount of photos and barely 1gb free on the internal storage, and i am the most active user of this app i believe lol).
来源:https://stackoverflow.com/questions/35468298/can-an-app-get-a-permission-to-a-whole-sub-tree-from-saf