Looking for a solution to record information I get from my device with ESP32

I'm looking for a solution to record information I get from my device with ESP32.

I see there is a lot of incompatibility with the API version / internal or external storege...

what would be the best solution, I get the information in a CSV line and I would like to save it in a file or export it to some place that can be saved and read later, but it has to run on all android devices regardless of the version and type of storage (internal or external).

Any suggestion?

the new table overview is confusing imho and actually it is quite simple:
the question is: do you need other apps to be able to access the file?
if yes, store it in Shared Storage
if no, store it in the ASD

Taifun

2 Likes

Thank you for your attention Taifun.

What I need is to make a LOG of all the information I get from the device and I'm already showing it on the app's screen.

I get the device information the same as the CSV files, like: data1|data2|data3|data4...

I was a little confused after researching the best method to do this, I see a lot of people complaining about the incompatibility of the API version and also if the file was saved on the memory card or internal memory, since not all cell phones have a memory card...

Sorry if the text is confusing, I'm helped by google translator.

Many thanks my friend!

don't worry...
we are not allowed to write onto external (removable) sdcards...
you only can write onto the internal (emulated) sdcard on all devices...

EDIT: you might want to answer the question...

Taifun

3 Likes

Taifun, the answer to your question:
I need to save the file in .CSV format to be able to open it later in another program, for example in excel.

  1. set the default file scope in the screen properties to Legacy
  2. use the file component, set the file scope of the file component to Shared and store the file in shared storage like /Download

Taifun

1 Like

Tainfun, thanks for your patience. I'll try and then let you know the result.
This is my first app and I'm still confused by the M.I.T.APP Inventor system.
Thank you so much.

I am now able to save the file. :partying_face:
Could you give me a hint on how to write each receipt on a new line? Because the file is overwriting itself with each receipt.
very grateful for your help.

Look for an Append to File block to use instead of that Save to File block.

1 Like

Nice TIP, thank you very much.

I apologize, I missed an error in your blocks.

You are doing multiple BlueTooth.ReceiveText operations in the same Clock.Timer event.

  • One of them saves incoming text to a file
  • The other adds incoming text to a list for further processing.

Unfortunately, the second ReceiveText asks for the NEXT piece of text to arrive, so you will lose some text that way.

It's better to have just one ReceiveText block in a Timer, going into a global variable, and have all subsequent blocks in the Timer refer to that global variable's contents.
That way, you can both log and process your incoming text.

1 Like

I really noticed a small loss of information.
Thanks for the observation. I'll try to fix it and post the block diagram here.

Dear friend, I tried to follow your tip, but I'm doing something wrong, an operation error is appearing.

And I try this, but have a same error.

variable info is your list and not DataReceivedList
DataReceivedList is just the received text separated by pipe symbol
you might want to rename your global variables accordingly...
info -> listInfo
DataReceivedList -> dataReceived

Taifun

1 Like

oh my god, i was seeing this now... total lack of attention from me
:grimacing:

It's working fine now, thanks Taifun, thanks ABG

I'm learning little by little and I'm enjoying it, I'm very grateful for your support.

Thank you very much for your attention!

I tested the app on android 8.0 and got error message: 908 - The permission WRITE_EXTERNAL_STORAGE has been denied

I'm asking for permission when starting the app, but even so the error remains, there is a way to get around this problem, as it only worked correctly on Android 10

when exactly do you get that error?
did you

Taifun

1 Like

Since it works as you claim on Android 10, WRITE permission must have been granted. This means that this permission is declared in the Manifest. Then it should / must also work for Android 8 (< 10).

Of course, when we talk about permissions, we always talk about the APK and not Companion.

1 Like