How do you copy file (taifunfile copyasync) to folder in internal storage (android 11)?

Save file works (however I don't see it in internal-storage / android / data, but I see it's working when I read the file) but copying it to a folder in internal storage with taifunfile extension copyAsync doesn't work anymore on Android 11.
Or I am doing something wrong.
btw. can copyAsync create the folder or do I have to create it myself first?

blocks(6)

1 Like

Copy it to one of the Shared folders (/Download, /Documents).

See also here:

3 Likes

Hi Anke, thanks for your reaction.
I tried /Documents/ instead of /rittenregistratie/ but that doesn't work.
Should I do something else?

Do you know if the fileName is correct to put in 'fromFileName' in copyAsync? Or should there be some path in front of the filename?

1 Like

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


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

2 Likes

The screenshots are at the top of this thread.
Filescope: private, I'm not sure if that's correct.. (however that works, and also reading from file works, so I guess that is correct)
Copying the file to Documents is not working.
Or should I do something with 'makeFullPath' or 'ApplicationSpecificDirectory'?
Or some permission?

btw. I have set the filescope in screen1 properties to 'legacy'. I saw that in another thread, it removes the errormessage about write access (908).

1 Like

Yeah, I got it!

1 Like

Just one thing is not quite correct.
Now the file gets saved in /internal-storage/Documents, but when I go to 'Documenten' via the categories (I'm in the Netherlands) the file is not there. I thought that would be the same folder, like a shortcut in Windows.

1 Like

that screenshot did not show your latest try with /Documents

how do you know, that it was saved now?
btw. for the file extension it does not matter, which file scope you use for the file component...

are you talking about a file manager app? which one are you using? did you try total commander?
probably a refresh of the directory will do it?

Taifun

3 Likes

I'm using the default Samsung file manager app.

1 Like

2 Likes

according to your screenshot are you saying, the files get stored in the subfolder /Documents of the shared storage /Documents which is called /Documenten in the Netherlands? This is interesting... To see how it looks like in English, just switch the kanguage of the device temporarily to English,,,

@Anke this topic is about shared storage /Documents and not about ASD... so we should see the files by using the default file manager app, too...

Taifun

1 Like

I switched to English. It's the same, when I save the file it is not in /Documents but in internal-storage/Documents. (I copy the file to /Documents (see earlier screenshot)).

I installed Total Commander. Btw. why can and does that app ask for permission to media AND files? So there is that possibility in Android 11 to ask full permission, also to files.. I understood that asking for permission is not necessary anymore for Android 11.

In Total Commander I can see the file is saved in /storage/emulated/0/Documents. I assumed that the /Documents folder I can see in the 'categories' in the default file manager app was some kind of shortcut to /storage/emulated/0/Documents like in Windows, but that doesn't seem to be the case otherwise I would also see the file there.

Is it possible to save the file in /Documents (see screenshot)? because that is where users go first to find the saved file.

1 Like

you are using a Samsung device, correct? I have a Samsung Galaxy A51 running Android 11...

the files which appear in the category Documents are actually files identified as documents stored in the shared storage /Download, so if you store the file in the shared storage /Download, you should be able to see it under category Documents...

Taifun

1 Like

Yes, A Samsung device.
in /Download? strange, I'll try it.

This is all you need (to save a .csv file directly in the Shared folder /Documents):

But if you are looking in the category "Documents" on your device, then only .txt and .pdf files are shown there (and not .csv files).

So go to → Main storage → Documents and you will see them.

Thanks everyone for the reactions.
So copying with Taifunfile copyAsync is not necessary anymore if I do it this way?
Is it futureproof? I was using file1 - fileScope 'app' now, You use 'shared' and 'legacy'.
So when I also will use those, saving -> fileScope 'shared' and reading -> fileScope 'legacy' that will work?

Try this app with Companion and the complied app (APK):
saveToShared.aia (2.3 KB)

And see also here:

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