Save CSV data / list as a file

Your blocks look correct...

It should work if you do not switch apps, ie. test only in the companion app or using the apk file...
As soon as you switch, remember what @Anke said

Taifun

Thanks for your advice but I have that in mind and thanks for pointing that out.

I deleted all the files were created. Then I saved a new version with my save button. I can open it. All worked. Then I only put the codeblock for filepicker additionally in screen-initialize and it does not work. Still the file can be opend with the file picker.

All described above with the companion only.

Use only the File.ReadFrom block without the filepicker as you did it in your latest screenshot

Taifun

Sorry but I don' t know what you mean. I shall delete the block out of the (how is it called...) "blocks development view"? I dont push the file picker. I only wanted to say that this logic still woks if i use it but opening the file in screen.initialize does not. I don't have the file picker in screen.initialize. This functionality only coexists.

@Taifun
I tried the following: I put the logic from initialize behind a switch (changed event). It also does not work. so it is not a problem of screen.initialize.

image

Then I tried writing a text in a label to make it visible if the logic of GotText is reached. That does only work with the file picker. In other cases when file.ReadFrom is called the event might not be triggered. Or an error occures when opening the file.

image

The last thing i tried for today is the following. I inserted some blocks in screen. inizalize shown below. While I was doing that the app asks for permissions for video, media and so on. I granted it. When testing nothing happens. Also the notifiere does not show anything.

image

It's unbelievable that such seemingly simple things can be so complicated or maybe I'm just stupid.

To read a text file which is owned by your own app normally no permission would be required, see also Some basics on Android storage system
Do you still get that permission dialog if you remove the filepicker component completely?
Let's see what our specialist @Anke is saying..

What you could do is to read the file after these permissions have been granted...

Taifun

Have you considered instead just saving the file off your device to an online resource ? Online storage is free/cheap and easy to use and access from your android device..

Yes, this is a bug on Android 13+ that I've definitely mentioned several times before. READ permission is requested incorrectly. Use my MFile extension to avoid this bug.

@ewpatton

1 Like

Unfortunately, I'm not a fan of the public cloud. If it were possible with a private mini cloud (usb device connected to fritz.box) I would consider it. I can't imagine it being easier.

@Anke, @Taifun: Thank you for all your support and Infos! I have taken a quick approach with the MFile extension. But quick approaches are never good. Unfortunately I didn't get it run. I had a look in the video and the blocks picture and thought that I understand what I have to do. But maybe I made a misstake or overlook something.

Unfortunately I can not spend more time at the moment. The weekend is over and I have to start programming for my job.

Now I have restored everything to standard file component. I'll give MFile another chance next weekend.

If not successful I'll build it in different way. I will request that the user (i.e. me) load the higscore at the beginning via the file picker (that's how it works). I use an indicator to determine whether the file has been loaded or not. Until that happens, I will simply not allow certain functions (e.g. deactivate the start button for the game)

Thanks again to you. I will be back as soon as i have new findings which might be interesting for others and leisure time

I use my own server, with my own security and encryption where necessary .

Need to go and find out what a Fritz box is :wink:

I would say it is in Germany the most common router for DSL / Internet / WLAN.

https://avm.de/produkte/fritzbox/fritzbox-7590/

Some of the devices (e.g. the one in the link) has a USB Port where you can plug in e.g. an externel HDD (in my case a SSD). The data which ist stored there can be accessed erverywhere in your local WLAN or also from Outside if you configure it. So it is one of a very simple kind of a NAS (network attached server).

I thought to buy something professional like from QNAP or Synology but for the moment it is too much for my needs.

Here are all the blocks you need (with a small correction):

Explain in more detail what role the FilePicker plays and show all relevant blocks.

After a long time I tried to continue with my app. It seams not to be a good day. In meanwile I read some more about the file scopes and i am more confused as before.Somewhere it was written that legacy ("Erbe" = compatibility mode) should not be used because it will disappear. For that reason I desided to use the build in File Component. But now I get the following error. I do not know what it means. Never got this error before.

Regarding the file picker: I do not need it. It is a workaround because when loading the file in screen.initialize the method file.gottext is not processed. If it still will not work automatically i will use a button to load the file. The file shall be created if it does not exist. So i do not need to pick up a file. The file for the highscore will always be the same for that app (hopefully).

Can you please give me a further hint what i am doing wrong? I hate that Android restrictions and the problems coming up with it when using file components in an own app which is created by the user itself.

Did you connect to Companion via USB?

See also here:

The File component needs (uses) a relative path (not a full or absolute).

"today" ist not "my day". Yes it was a misstake. I changed it after making the screenshot. but there is no difference. I do not understand where the join result comes from.

What you point out in the line from you ist new for me. I was happy to get it finally run with the AIStarter (and that many versions and different kinds of installations exists). When we wrote in march to that topic the problem did not occur. I will have a further look to my test/experimental project. maybe i find any difference...

if I do it like this the file is created...

image

save in the open procedure only for a quick test purpose

it seam to be a problem only in the file.exists function. is there a possibility to recognize the error when trying open the file when it is not existing e.g. in event screen.error and create the file initially in that case (in the way i tried it with file.exists) but without that function

grafik