4

Background

Ever since Kitkat (API 19), Google has added a few restrictions and APIs for accessing the SD-card (or more precisely, the second external storage).

Third party apps can no longer write to the SD-card on any folder but their own, unless they have a root permission or they are system apps.

Google has added a built in system app that can manage files on the SD-card, called "file picker", and it has a few opeartions that can be done by the user.

The new API is called "Storage Access Framework". More information about it can be found here.

The problem

There isn't much information about how to handle specific operations that were always possible before. Granted, they were used for all external storage operations, but Google only recently handled this type of storage.

I also didn't find enough information about the available things that can be done on the new "file picker", and what cannot be done with it.

The framework seems to support operations on files that belong to other apps, but some files were copied by the user (from the PC, for example), so I'm not sure how those can be handled.

The question

  1. how can I handle the next operations on the new API: create,delete and modity any file/s, anywhere on the SD-card ?

  2. Is there an intent for opening the new tool, to show the user a specific path, where he can do the operations on the file manually ?

  3. Can I assume that starting with Kitkat, the tool will always exist? What should I do in case it doesn't? Are there any alternatives?

  4. For the users who have "fixed" this restriction of writing to the sd-card (using this tool, for example), is there any official way to identify if full access is granted or not? Other than just trying to create a random file somewhere and delete it, of course...

  5. What are the available intents on the new API ? All of the intents I've found are related to handling files of other apps, in case they support it, but I can't find any that handle any path to files.

android developer
  • 114,585
  • 152
  • 739
  • 1,270

2 Answers2

1

CommonsWare has a series of blog posts that (mostly) address part 1 of your question:

The entire blog post series covers:

There doesn't appear to be any documentation on the rest of your questions (which is not surprising, since if there was you wouldn't have needed to ask the questions!)

zmarties
  • 4,809
  • 22
  • 39
  • Do you know at least the answer to #4 ? this is something that I need for my app, as it works for both rooted and un-rooted devices (has more features for rooted devices) :https://play.google.com/store/apps/details?id=com.lb.app_manager – android developer Sep 07 '14 at 13:45
1

I think there is a similar question as yours and a wonderful answer provided by Google engineer, please see it here: How to use the new SD-Card access API presented for Lollipop?

Zhixin Liu
  • 141
  • 2
  • 2
    This is tricky - normally answers should not just be links, but copying the whole body here would be pointless. Closing this question as a duplicate of that one won't work either, because this is about 4.4+ and that one only applies to 5.0+ which as of today means most devices fall in the gap between the two. – Chris Stratton Feb 24 '15 at 19:40