Save issue on samsung s20

Hello everybody,
I have created an app that saves a file in storage.
It works fine with Huawei mate 10, but when i tested with Samsung S20 this message appears and nothing saved:

/STORAGE/EMULATED/0/"folder amd file name": open failed: ENOENT (not such a file or directory)

I tried to create the folder manually, and the message changed as following:

/STORAGE/EMULATED/0/"folder amd file name": open failed: EPERM (operation not permitted).

Any ideas please?

Sirous

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.

could you tell the android version of ur devices

@TekWizer samsung 20 might have android 11 not sure

thats what i thought maybe this will work @Sirous_Nekooei -

Sorry, I was away for a long time.
Here is the block:

starting with SDK30 you are not allowed to store a file in the root directory of the emulated sdcard anymore... store the file in the ASD...
see also the overview by @Anke here

Taifun

Many things has changed.
Could you pls give a simple example of writing and reading files (canvas as image, screenshot, and csv data)
Sirous

you can find several examples after doing a search here in the community
see for example again the link provided by @TekWizer
Save a text file or an image (Canvas) in the ASD & share it on all Android versions
there was no change in reading and writing from/to the ASD - application specific directory

Taifun

Thank you.
I developed an app for my personal project last year.
Now I have to modify it so that it works on new androids.
I tried to use Anke's tutorial to use ASD, but I have problem with file path/name.
Could you pls re-write this simple project to use ASD for save/load/share ?
write_read_test.aia (11.6 KB)
Thanks
Sirous

sorry, I do not have time for that...

If you are asking for help, I recommend you to make it as easy for others to be able to help you ...
You probably will get more feedback then...

which means in your case post a screenshot of your relevant blocks...

To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc... this takes time, and most people will not do that...
Thank you.

Taifun


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

Sorry, I thought aia might be easier for you to deal with.
Here are blocks:

Thanks
Sirous

1 Like

to save a file using the Canvas.SaveAs method, just use the filename, for example 1.jpg to save it in the ASD, you do not need all these blocks...
same for displaying it in the image component
Taifun

1 Like

Use variable for saving and reading
blocks5

probably better to use a label, then you can see where it got saved :wink:
(nothing wrong with using the evaluate but ignore block though)

1 Like

Well, it worked to some extent.
Saving is Ok, but when loading which syntax should be used?

These worked:
file:///storage/emulated/0/Android/data/appinventor.ai_snekooei.write_read_test/files/1.jpg
/storage/emulated/0/Android/data/appinventor.ai_snekooei.write_read_test/files/1.jpg

These didn't work:
1.jpg
/1.jpg
/files/1.jpg
/Android/data/appinventor.ai_snekooei.write_read_test/files/1.jpg

just use one of those, which are working, it does not matter which one...

sorry, that tip was wrong... this would display an image from the assets
Taifun

2 Likes

If → DefaultFileScope is set to → App (default) the → fileName should be (/1.jpg or 1.jpg)
grafik
and the path (where the file is saved) is:

/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/1.jpg

regardless of the Android version.

The Image component needs an absolute or a full path:

Thank you, now it works except something.
Taifun screenshot saving doen't work with error "....No such file or directory"

Any suggestion?

These blocks have nothing to do with your posted aia or your previously posted blocks.

Make a right mouse click on this block (Do it):


and post the result.