Saving settings in TinyDB works in companion but doesn't work in apk

Hello friends! I’m new here and so far was able to find an answer to every question right here, already asked and answered.

But this time I’m in a dead-end and wouldn’t even know how to search for such a problem. So here it is.

I am saving the setting of my app in a single tag in TinyDB as a dictionary. It works exactly as intended on the companion. Meaning, that I can change the settings, close the app, reset the connection, and upon relaunch the settings change from default to what I set it to.

However, when I download .apk this magic stops working :sob: Set the settings, relaunch app - get default settings every time. It feels like the settings are not being stored properly when I change them.

I bet the answer and solution are simple, but I struggle so much with it. Please help :disappointed_relieved:

Here are the blocks that are used in the process

SettingsCall procedure just displays the settings
image

I also know for sure the tags and tinyDB do work. The app starts on another screen, saves the state, then skips the first screen when relaunched. So the problem is for sure in this specific tag and how I save it or read it…

You only store tinydb in block when voiceClicked or is there any somewhere else?

at the moment only here, yes. Still figuring it out

It gets so much stranger. I wanted to see what is being saved in a variable and in tinyDB. So I added this
image

Cleared tinydb through “clearALL”

The result looks like this

Which is strange. The first label is the global variable and is set when the screen is initialized. But the second label is from tinyDB and is supposed to empty, because I cleared it and am not setting it anywhere.

I thought maybe calling values from tinyDB to global Settings messes with it somehow. So I removed that whole step

Now the result is even weirder:

A random value is still being saved in both places. I checked everywhere And I’m not setting it anywhere. The only place where I’m saving it is through click- -
image
Which is not being touched.

OMG I think I answered my own question. Will update in a few hrs

Yep. I’m going to leave this here :joy:

In short - In a companion setting switches in the right position from “Settings” stored in tinyDB worked as intended.
image

BUT in apk somehow it counts for .Clicked and so triggers these commands
image
messing everything up.

Removed switches and placed checkboxes with all the same functions and commands. Works perfectly fine with companion AND APK!!! :partying_face: I’m just brilliant :thinking:
Thank You Thank You Applause GIF by Warner Archive