Save a text file or an image (Canvas) in the ASD & share it on all Android versions

How to save a file (text, Canvas: image) read and share it on all Android versions.

Note:
You cannot share a text file from the → Private dir (internal storage):

/data/user/0/<packageName>/files/
8 Likes

great guide, thank you!

as alternative it might make sense to provide a tutorial, which stores text files or the image always in the ASD for all Android versions, so later when App Inventor targets API30 in late 2021 the app still will work...

Taifun


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

1 Like

This app (tutorial) will also work (for all Android versions) when AI2 is targeting API 30targetSdkVersion = 30.

yes, correct... the example to store something still will work fine... sorry, I was not precise enough...

what I'm talking about is you will not be able to access the previously stored text files or images anymore outside of the ASD....
therefore it makes sense to use the ASD for all Android version already now rather than still storing in other directories

EDIT: you will only have to adjust the canvas part to always store in the ASD...

Taifun

This should do it:

1 Like

This tutorial is incomplete without a reference for where to get that GetASD1.AppSpecificDirectory block.

3 Likes

Correction: It is possible!

I created these blocks from scratch and adapted them to the new File component and the new file system. I'm still wondering whether I should update it here or create a new guide.
Any suggestions from you guys on this?

See how it works here:

2 Likes

Is there any wrong here ( Greater than sign )? :roll_eyes:


What i understand is that we use

if the sdk > 29, So this sign must be less than ( < )

This guide was made before the nb187 release (and of course before nb188) and is therefore no longer up-to-date.

1 Like

Thank you @Anke for your efforts
How can we save the csv file to the phone memory?photo_2021-11-13_11-31-45

I answered it in the Kodular community.
(But with AI2 it is different.)

1 Like

For AI2 (since the nb188 release) this is all you need to save a text file in the ASD (or in my example in a sub-folder of it) on all Android versions:

3 Likes

Hi. Did you create another guide?

Can you attach the aia file please?