Unable to Share a Data File

Phone: Moto E4
App installed on phone.
Unable to Share a Data File.

File name: /CisternData.csv
Data stored and retrieved by App.
File location on phone: settings->Storage->internal shared storate->Other->CisternData.csv
Computer File Manager from Computer could not See this file. It could see other files and folders.
File deletion from app okay.

Tried to Share this file: “The file ///CisternData.csv could not be found on your device.”

What is the correct File Name to allow Sharing on a Moto E4?

You can’t share an asset file, Android doesn’t allow it.

Workaround:
Copy the file from assets to a local folder with this block:
copy

With this extension:
http://puravidaapps.com/file.php

2 Likes

Thank you. I will read your article and try the extension. I will report back.

Bill

1 Like

The DirectoryList extension allowed finding the system name for the sd card, thanks.
The files are the ones on the sd card, viewed from phone file manager.

The message: /storage/FF68-EA25/CisternData (Permission Denied)

The phone permissions to allow storage for App Inventor is turned on.
How should the requested permissions be enabled?

Try this:

Ken, Thank you. Read vs Write permission request, cut and paste strikes again.

Still no luck. The first screen shot shows the date read from the local file.
The second shows the attempt to copy it to the sd card.
Still getting Permission Denied on the write attempt.

Your paths are wrong.

Use “//filename” for from
And “/filename” for to

Ken, If the app attempts to write the data to //CisternData.csv the message indicates it is not allowed to write to the Assets directory.

I will test other combinations.

you can't copy a file to the external sdcard, see also the discussion below the Copy method here App Inventor Extensions: File | Pura Vida Apps
what about copying to the internal sdcard?

If the app attempts to write the data to //CisternData.csv the message indicates it is not allowed to write to the Assets directory.

therefore @Ken suggested to copy to /CisternData.csv (only one slash, which is the internal sdcard), see also the documentation here App Inventor Extensions: File | Pura Vida Apps
protip: read the documentation

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

1 Like

Ken and Taifun, Thank you for all of your help. I was attempting to be too complicated.
AppendToFile with file name: /XYZ
ShareFileWithMessage with file name: /sdcard/XYZ
and the previously saved data file is sent, Gmail was selected, as expected.

Bill

1 Like

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