Save files on any android version

Hello, I would like to know how to save files regardless of the Android version. Thanks very much

what kind of files are you talking about? text files? images? videos? audios?

the best place to store the files probably would be the application specific directory...

Taifun


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

text files, should I save them without specifying the path? just entering "file.txt"? How do I find that same file after saving it to be able to share it? in the same way "file.txt"? Does this work for all versions of Android? for AI emulator too?

See here (specially → point 1.2.)

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

I think the Sharing component cannot access a file from the Private dir.

I thought if I could create a file, I could share it too. I currently create and share a file, but on Android 10 it fails, I wish I could fix this. These are my blocks ...

grafik

sory

The folder for this fileName doen't exist:

This would not work on any Android version.
You have to create this folder first.

Esto funciona en cualquier version de Android menos en la 10, realmente no estoy especificando un directorio, solamente la "/", por lo que el archivo txt se esta generando en mi almacenamiento interno, que imagino debe ser la SD emulada. Como podría hacer para que funcione con Android 10? Realmente no me interesa en donde se genera el archivo, lo que me interesa es poder compartirlo luego, asi que me da igual en donde lo guardo...

Google Translate:

This works in any version of Android except 10, I am not really specifying a directory, only the "/", so the txt file is being generated in my internal storage, which I imagine must be the emulated SD. How could I get it to work with Android 10? I'm not really interested in where the file is generated, what interests me is being able to share it later, so I don't care where I save it ...

Ahh sorry, my fault, I saw a slash more ...
So the text file is saved in the root directory of the external storage.
I'll check that later ...

Try this:

No problem!

and to save the file? if I leave it like this it doesn't work ...

Post the aia (or a small test aia).

here it is

miniSaveExport.aia (35.1 KB)

This aia has nothing to do with the blocks you showed above (before).

Try this: miniSaveExport2.aia (55.8 KB)

1 Like

But it's the same, a little version of what I need to do

ok I try it and then I'll tell you, thanks

It works even on Android 11 (Beta), checked with Companion.
So post your (real) aia, so we can check where your problem might be.