How do you choose files from ASD and export them?

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.

1 Like

save_test.aia (105.4 KB)

Access to shared folder (writing) is not permitted at all.
Lets try a simple code here:

1 Like

Correct, the DefaultFileScope is essentially responsible for two things:

  1. Where are files, created with components that can save something (ie e.g. Canvas), stored.
  2. 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.

grafik

1 Like

Sorry, but I have tested "legacy" without success.
Let's check everything:
Screen1 properties : DefaultFileScope :Legacy

File1 Properties: DefaultScope; Legacy
ReadPermission TICKED
WritePermission TICKED

Blocks:

When the app is launched:
upon clicking the save button, askes for Permission:

Then this error pops up:

When I go to settings.......permissions:

But altogether, nothing is saved.

1 Like

Try this one: save_test_2.aia (105.9 KB)

1 Like

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...

Taifun

2 Likes

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!

1 Like

I believe you have to delete an existing file in the Shared area before you can save it again. You cannot overwrite.

1 Like

Tried that, no success...

1 Like

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).

That's why I added this (delete) button:

1 Like

Otherwise (to avoid this prior deletion) you must append a timestamp to the filename.

2 Likes

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...

1 Like

Ok, I understand. Then try this one:
save_test_3.aia (106.8 KB)

It will work always regardless of Companion, APK, un-/reinstallation, removing files, dirs etc.

Blocks

5 Likes

Hurrah....
It works
Now I am going to test it in my own app

1 Like

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?

I already answered this question here:

The TaifunScreenshot ext. saves screenshot.jpg in the ASD.

:cry::cry:

Is there any way to save screenshot in the shared folders? Other extensions for example?

Move it from the ASD to one of the Shared folders using the File comp. or the TaifunFile ext.

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