Google brings new developer tools to allow for more access in Android 5.0 Lollipop
Google has brought a new set of tools for developers to leverage the SD card on your phone or tablet with Android 5.0 Lollipop. Using a new intent, applications can now have read and write access to directories on removable storage — even directories they do not own. Google at its developer conference this summer announced it would be addressing this issue, and today things were made more official with an announcement on the Android-platform Google group.
Here's what you need to know.
Hey all, in KitKat we introduced APIs that let apps read/write file in app-specific directories on secondary storage devices, such as SD cards.
We heard loud and clear that developers wanted richer access beyond these directories, so in Lollipop we added the new ACTION_OPEN_DOCUMENT_TREE intent. Apps can launch this intent to pick and return a directory from any supported DocumentProvider, including any of the shared storage supported by the device. Apps can then create, update, and delete files and directories anywhere under the picked tree without any additional user interaction. Just like the other document intents, apps can persist this access across reboots.
This gives apps broad, powerful access to manage files while still involving the user in the initial selection process. Users may choose to give your app access to a narrow directory like "My Vacation Photos," or they could pick the top-level of an entire SD card; the choice is theirs.
OK. If you're not an Android application developer, that looks pretty complicated. In fact, it is pretty complicated, so it's a good thing that Google did most of the work. But we can try and simplify things a bit.
Using this new method, a developer can now declare a permission on installation (that's part of that list of items we usually gloss over) to do "things" on device storage — including removable (read: SD cards) storage. One of the things they can do is allow you to choose what folder(s) on the SD card you want the application to be able to change. This could be one folder — like "Music" — or the top level folder. Anything inside this directory can be read, written, and possibly deleted.
Simply put, this means that an app like Poweramp can now edit tags on the songs you have in the Music folder. Or a photo editor can save to the Pictures folder, and not just its own folder. Or a file manager can move files around on the SD card. All the developer needs to do is update the app with the new methods.
There will be issues with some apps. We can count on that. And you'll need to allow for a new permission that gives an app almost unfettered access to your device storage — both internal and external. But this is a (mostly) safe way to allow applications to have access to the storage on your device that bypasses standard filesystem commands in favor of a document model.
Now who will be first to implement it, and when will a device with an SD card see a Lollipop update? We'll just have to see.