To save an image with the Canvas component in one of the Shared folders directly you must set DefaultFileScope to Shared or Legacy.
Otherwise set it to App, save the image in the ASD and then move it to one of the Shared folder using the File component or one of the File extensions from @Taifun or @vknow360.
Correct, the DefaultFileScope is essentially responsible for two things:
Where are files, created with components that can save something (ie e.g. Canvas), stored.
Which permissions are declared on which Android versions in the Manifest.
To store files directly in the Shared folder /Documents with the Canvas component, DefaultFileScope must be set to Legacy, as this is the only way to declare both storage permissions in the Manifest. On Android < 11 both permissions are required. Unfortunately with AI2 also incorrectly on Android 11+. I've mentioned this bug countless times.
Yes, this is another bug with the File component, that I also mentioned some times. But anyway, you need to set the DefaultFileScope to Legacy as I said before.
Your question was to save something using the canvas... so you should use the canvas for your tests... sorry, my previous answer about the default file scope was wrong, I corrected it meanwhile...
testing the file component to save some text will not help for your purposes...
Thank you so much. It worked. But I am totally confused.
At 1st installation, it saved without difficulty. but at later times, it could not save. Tried several times, looks like randomly working.
I am very close to give up!
As I wrote, you must delete the file before testing with the APK and vice versa.
Because if you first saves the (non-media) file with Companion, the compiled app (APK) cannot overwrite this file because it was created by another app (Companion).
I don't use companion. I test on my phone. I uninstall the app, delete the file and folder already is created, delete the downloaded apk, then again compile the project...
And if want to avoid storage permissions on Android 11+ use my MFile extension, which does not require storage permissions (READ/WRITE) on Android 11+ for the Shared folder (like /Documents or /Download).
My project has csv file save, canvas save, and screenshot save (with Taifun screenshot extension).
How can I determine the "scope" for canvas save and screenshot save?