Currently I am able to implement store and retrieve file from Google Drive without issue but I want to add an additional functionality which is to save the file directly to local storage.
In dropbox app, if you try to export a file and in the chooser select 'Save to device', it will show something like below:
At first I thought they created the activity themselves but it looks very similar to the ACTION_GET_CONTENT intent that I am using.. My code is just something like:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("application/*");
startActivityForResult(intent, 0);
which show something like below:
That makes me think that Dropbox app must be using an Android intent to save file to local storage like ACTION_ADD_CONTENT or something.. Or am I wrong?
Thanks.
Kuffs has it right — you are seeing the UI for the Storage Access Framework. Specifically, for a "save as" sort of feature, use ACTION_CREATE_DOCUMENT
. You will get back a content:
Uri
for the location that the user chose, and you can use a ContentResolver
and openOutputStream()
to write your data to that location.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With