[Android] Writing on external sdcard

XilasZ xilasz at gmail.com
Wed Aug 5 11:52:36 CEST 2015


Hello,

As you may know, since KitKat, apps can't write on external sdcards (except
in app private folder, but using a new API), so we can't delete file on
external sdcard anymore.
In lolipop, google introduce yet another API to change that.

First, the app calls ACTION_OPEN_DOCUMENT_TREE to ask the user to select a
folder (for instance /sdcard2/Movies), it return a tree uri
(/tree/3638-3334:Movies) and then we can set a write permission on this
folder.
After that, it's possible to write in that folder using DocumentFile API
from the tree uri.

I did some testing, i implemented a preference to select/set write
permissions and get tree uris (and revoke them by selecting them again).

I don't know yet how to know if a path is under a tree uri, how to get a
DocumentFile from a real path (/sdcard2/Movies/blabla.mp4), or if it's even
possible.

So the patch is mainly a poc, but that's a start, what do you think ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/android/attachments/20150805/9d015435/attachment.html>


More information about the Android mailing list