Hi, I have a problem using file, I tried to use SAVE or APPEND methods but I get "error2103 the file ... could not be created". At the beginning I don't write any permissione cause I read that you need no permission to write in the app directories. Then I tried writing permission. I tried with legacy scope, with private scope, app scope... I tried to write in Downloads directory, in app directory... I don't know what to do. I run in Android 13, samsung tablet. Have you got any idea? Thanks.
Can you provide an example of the save or append block call you use?
Thanks for your answer.
The check I am doing is in the ELSE block, no matter what is before. I write permission in screen1 about writing. I try to write a file with the time I got at the start of the app.
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
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.
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.
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