Skip to content

✨ #65840 Save a file - #23

Draft
gantelo wants to merge 5 commits into
android-packagefrom
65840-save-a-file
Draft

gantelo wants to merge 5 commits into
android-packagefrom
65840-save-a-file

Conversation

@gantelo

@gantelo gantelo commented Sep 30, 2022

Copy link
Copy Markdown

This PR adds the Android implementation for the file_selector package, specifically for the getSavePath method.

Issue related: [file_selector] Add Android support #110098

getSavePath receives two possible arguments:

  • initialDirectory: where to save the file, if possible
  • suggestedName: to append a save name for the file to save

This method supports Android SDK 21+ and manages every save path possible. I.e.:

  • ExternalStorage
  • Downloads
  • MediaProviders

Instead of returning a full unparseable URI, it creates a 0B file with the name and type presented and returns the storage path for the user to call the XFile.saveTo(filePath) method.

The example does this exactly. It prompts the user to select an optional file name and an optional text to add, launch the intent, and save the file.

We tested this with text in our gifs, but it works with file types, such as base64.

Android Nougat Android S
saveAFileNougat saveAFileAndroidS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant