@TekWizer samsung 20 might have android 11 not sure
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 Taifun.
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
Use variable for saving and reading
probably better to use a label, then you can see where it got saved
(nothing wrong with using the evaluate but ignore block though)
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
If → DefaultFileScope is set to → App
(default) the → fileName
should be (/1.jpg
or 1.jpg
)
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.
Three files are to be saved. the first and 3rd are save fine. The second fails.
Do It Result: ECG_Save2021/11/13 16:41--Long.jpg
Do It Result: ECG_Save2021/11/13 17:08--Short.jpg
--- (This Fails)
Do It Result: ECG_Save2021/11/13 16:41--Data.csv
Maybe there is something about Taifun screenshot?
PS: i granted the "permission to write to external memory" on screen initialize, but nothing changed.
are you using the latest version 2 of the screenshot extension?
https://puravidaapps.com/screenshot.php
does the example project work for you?
Taifun
Of course, because the (sub) folders don't exist.
The TaifunScreenshot.FileName
should be e.g. like this:
ECG_Save2021_11-13-17:08_Short.jpg