Problem to save Canvas as Image and Upload it to server with SDK > 30

I am trying to save Canvas and upload it to my server as an image.

Below SDK 30 all works well

On my Google Pixel (Android 11) I am getting the fllowing error after installing the app:

In Companion, everything is working as intended, Canvas will be saved and copied to another folder, but in the app it is not working, i am getting the error above

Here is the relevant block:

Did you search in the community?

In android11 ​​it is not possible to save files to any folder. You have to save either to the ASD or to one of the shared folders. If you want to save the image, it will be the DCIM folder. After that, what is this "Android file" extension?

Dear @Patryk_F,

Thank you!

I know the "problem" with Android 11 and have changed blocks as follows:

in COMPANION, everything is working, see screenshots:

Here we have the path of the file and the filename:

And as a result, the image is in the correct folder after moving:

But as mentioned, after INSTALLING the apk on the phone, i am getting errors

PS: AndroidFile is Taifuns File extension

Yes, but i didnt find THIS specific EPERM error

Ok, now I am getting an other error:

"Sorry can't move a directory"

Hi Anke,

Thank you very much, I will try it when im at home again.

But it is working in companion, even the directory was not exisiting before (see post) :thinking:

From the ASD directly it can not be shared, using the WEB component i assume?

It's not about whether the folder can be created, but about whether it makes sense to create one that generates the ASD path twice.

it can be shared from there
btw. why do you have 2 solutions? you might want to store in ASD for all Android API Levels...

Taifun


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

in sdk > 30? but how? with the web component it does not work...

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.

Another idea would be to convert the file to a Base 64 string using an extension and upload it to the server using PHP.


you are trying to share from the /Download folder and not from the ASD
also you should redesign your app and store your data in the ASD rather than in directory /kundc... remember the new Google restrictions... see also

EDIT: usually a full path starts with file:/// (3 slashes)

Taifun


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

Yes, I am trying to share from /Download, as sharing from ASD has give me errors (see post 1)

Best would be to save and share from ASD, but it does not work

Dear Anke,
thank you very much for the suggestion and help, perhaps I should explain from the begiining what I am trying to do (and what IS working below Andoid 11)

First, the Canvas (a signature) sould be saved:

When all is finished, the signature should be uploaded to my server:

As mentioned, this is working on all devices below Android 11 (SDK < 29)

Now the problem is, that when SDK 30 was hiiting, this solution does not work anymore.

So the question is, how can this be adapted to work on both (below 30 AND with sdk 30)

I tried to SAVE in the ASD, which is working, but I can NOT UPLOAD it from there, for this reason I thought I would work when I move the file outside from the ASD to another folder, but this does also not work.

So, how can my png file be uploaded DIRECTLY from the ASD ?

I had no problems with that (uploading a file from the ASD to my server) using this extension:

I checked it again on Android 11: Works fine.

1 Like

Working OK for me, companion and compiled on Andoid 11

image

Perhaps check how your php is working ?