I can't use the Sharing component to share text files because I don't know the file path


I can't get ShareFile to work. I've used SaveFile to save a (txt or csv) file (e.g. \filename1) which I can retrieve using ReadFrom, but ShareFile doesn't work. Whatever file path I try (including the suggestions at http://ai2.appinventor.mit.edu/reference/components/social.html#Sharing) it produces an error message saying the file could not be found. I've tried it with LegacyMode turned on and off.)

I originally posed this question in August 2019 with a suggestion that the way the Sharing component treats file paths should be consistent with the File component. I received an acknowledgment from Susan Lane, but heard nothing more. At the time I abandoned the Sharing component because I could easily use other apps (mainly Google Drive) to share my files. However, I now learn that this will cease to be possible as Google are not allowing apps to use shared space in storage (http://appinventor.mit.edu/blogs/evan/2020/08/08/file-path-updates-android-10#what-this-means-for-app-inventor-applications). This means that using the sharing component is now essential!

Many thanks in anticipation of help.


Are you using extension for AppSpecificDirectory ? Show please your relevant blocks

Yes I am using this extension and another - many thanks to @Anke. The block for the directory for saving, appending, reading or deleting is
SaveReadDeleteFile in ASD
and the block for sharing is
ShareFile in ASD
In both cases you need to join the name of the file to the end of the directory and then put the whole block in the FileName slot.

What still puzzles and frustrates me is why ShareFile works differently from Save, Read etc. The appinventor team obviously has some code that makes the File component commands easy. Why can't they put the same code in the Sharing component?? :confused:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.