Saving a file using the Android vault access platform

I am integrating Document Access Framework with my cloud storage access application. Using this documentation, I was able to access the file and get it (I just use the attach function of the Gmail application to verify this).

Now I'm trying to find how to save the file using the same method (save the file directly through the application to the cloud storage), and I made the following changes:

To call getRoots

row.add(Root.COLUMN_FLAGS, Root.FLAG_SUPPORTS_CREATE); 

and I also overcame the createDocument method.

I do not see many examples of code or documentation on how to do this. I also see that in several applications, such as the Photos application, there is a Share button that uses a different method (miniShareActivity is displayed in the logs), and my application does not appear in it (it looks like it uses a different sharing mechanism files)

I am looking for information about

  • How to use SAF to store a file (any example file will be great or a pointer to the documentation). I assume that this will allow the user to use the select interface to navigate to the folder and save the file.

  • How to make the application appear in the "Minishare activity" application list for importing the file into the application (it seems that it does not provide a selection interface, but I would still like to provide support so the file is saved in the default location)

+8
android android-fileprovider storage-access-framework
source share
1 answer

The Share button that you talk about in other applications probably uses ACTION_SEND as an Intent action, not the ACTION_CREATE_DOCUMENT that was introduced using the repository access platform.

You might want to support both options, since ACTION_CREATE_DOCUMENT was introduced only in KitKat, and older applications may not be aware of this. Similarly, you can also support the Intent ACTION_GET_CONTENT action for read access on pre-KitKat devices (ACTION_GET_CONTENT is handled by SAF when running on KitKat +, but your application should still handle it when running on pre-KitKat). Are the <intent-filter> in your AndroidManifest configured to match all of those types of Intent?

0
source share

All Articles