Copy file to ASD with SAF - Error

I have a problem with the method DocumentCopiedToASD of the extension saf.

The "Pictures.zip" file is in a subfolder of the Download folder.
I would like to copy this into the ASD using saf.

If the selected file has the same name as in the ASD, nothing will be copied.
It only works if the file names are different.

Am I making a mistake or is there a bug here?

For clarification, here is the aia file:
Test_SAF_2screens.aia (571.3 KB)

Frank

Show you blocks.
(I changed the category from bug to help, because there is no bug.)

It does not work:

Works well:

Frank

Moving to the same location does not make any sense at all.

@Anke

Thanks for the tip.

Now it works without renaming.

Frank

/Download is a shared folder - so you shouldn't need SAF? However, how did the file get into /Download in the first place? If it was a download, you can instead use Anke's extension to download directly into the ASD:
https://community.appinventor.mit.edu/t/extension-to-download-a-file-to-asd-app-specific-directory-without-write-permission/19367/157

The file is a backup of the most important files for the app.
It comes from a PC or from a backup folder somewhere on the smartphone.

As far as I know, this only works with saf.

Frank

From the App? So this is a personal use App, not shared or distributed.

See this guide by Anke:

There is an excellent diagram which shows you do not need to use SAF for read or write in this case.

Given that it's a backup, have you considered uploading to the Cloud, Google Drive for instance?

There is also an extension:

There is an extension dedicated to backups only.

@Frank-HRO
ASD gets deleted when user uninstalls the app so you should upload backup to cloud.

1 Like

@ChrisWard and @vknow360

The file is a backup of data from the app.
It is clear to me that I do not need the extension saf for this.

However, should the user delete and reinstall the app or reset (erase) the app's data, they can use the backup to feed their app back up with the backed-up data.

I am currently creating a folder under Download and backing up the data there. From there, after selecting the file, they can be copied to the ASD using saf and then restored.

I am aware that storing in the cloud is the safest way to back up the data. This is particularly important if the app is to be reinstalled on a new phone. With my current solution, the user has to save the file himself when changing smartphones.

I've already experimented with the linked information.
Since my backup file can quickly become 100 to 200 MB in size, this doesn't seem to work.

Frank

Hi Frank

On a smartphone, it's better to backup the data in batches (directly to the Cloud), at the time it is created - so ten or twenty files of 10mb each during the course of one session, or, depending how the data is created, temporarily stream to a file in the ASD first, then upload that to the Cloud (again, strictly monitoring file size). We don't know what your App actually does so it's difficult to give more specific help.