I cannot save a file in any directory

With ASD do you mean the external SDcard? I would like to save in internal memory, I have not a SD card in the device.

Use a relative path, I e. /Download/yourFilename.txt to save in shared storage

See also Some basics on Android storage system

ASD = application specific directory

Also set the filescope to Shared and the default file scope in the Screen1 properties to Legacy

Taifun

I tried to save the file just writing the name of it without "/" in the fileName (file.txt), I believed the file would have been saved in the ASD. In this case I don't get any error but there is no file in the ASD.
I take a look to he link you gave me thanks

You first have to decide, where you like to store the file and then set the file scope and file name accordingly

Taifun

Maybe the problem is that I have a not rooted device, so I cannot write in internal memory?

No
You are mixing up different solutions
See my previous answer, try something and show your relevant blocks

Taifun

1 Like

I would like to store the files in internal memory, in the app specific directory if it is possible. It is an app that I only want to use in my devices. Which scope is best for this?

Set the file scope to App and the filename to a filename of your choice
You will need a good file manager like Total Commander to see the stored file

Taifun

Thanks I try to set file scope as you said.

No.

:cry: so the solution is: to buy a SD card or to root the device?

No, you cannot write to a removable (micro) SDcard since Android 4.4 (KitKat, API 19).

There are many topics about the File component and saving non-media files. So search the forum.

@ewpatton (Reported Dec 2022)

1 Like

Thanks a lot. So if I understand correctly, I need a rooted device in order to save a file in the internal memory, whatever directory it is... So is it useless to try if I have not a rooted device. Right?

This is how I changed the block. I don't receive any error message now but there is no file created in the ASD.

Again NO
As already answered earlier

Follow the latest link by @Anke to find a working solution

Taifun

You don't need rooted device, you can save in ASD (app specific directory) with these blocks
Immagine 2023-04-25 203111

I supposed the answer "NO" was intended as "No, you cannot write in a not rooted device", and not "NO, what you are saying is not right". Anyway thanks to all of you I have found what was missing in the code: the filescope APP. Thanks a lot.

Usually FileScope = App does not need to be explicitly set via blocks, as this is the default setting of the File component in the designer.

So if you intend to store files in the ASD, there is no need to change the default setting in the designer and then change it again via the blocks.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.