Reputation: 189
I need to save some files to a directory the user could open from his folder explorer app. I tried using the ShareButton and the share function from Display but it does not allow to save to the fileSystem.
I wanted to use FileChooser to let the user pick a folder in order to get the folder path and save my file in it but I don't think you can select a folder using The FileChooser.
So I thought I could use FileSystemStorage using getRoots and listFiles to let the user find the folder he wants to save the file to. But I noticed that getRoots does not return the sdCard path of my Android 8 device.
And even if the FileSystemStorage returns the sdcard path corectly, it does not make sense on IOS since there is no public folder is IOS ? Or can we export a file to a document directory ? I also don't know what would return getRoots on IOS since I don't have an iphone.
I am starting to think that to export a file I will have to do it natively. Am I correct or have I missed something ?
Upvotes: 1
Views: 159
Reputation: 52770
iOS doesn't really have something like an SD card or a shared directory. You can do that in Android using a bit of manifest wiggling in Codename One but I don't have any experience with it. Frankly it's a bit of a gray zone since things behave differently between Android versions and I just wouldn't go there.
Share should allow you to send a file to any other app similar to the way intents work on Anroid. It should work with iOS too and is the best way to share a single file. You can also use email to send an attachment if you are looking for that specific case.
The trick with share is to pass it a file system path within the app home directory. Once you do that our native implementation transfers it to the appropriate API's that make it accessible to other apps.
Upvotes: 1