Android app variable managment issue

Hi, I’ve created a sketch to set a variable value by Android application (always seeing the variable value by serial console)

Everything is ok, I can set the variable value and confirm by serial console report.

But when I refresh the device menu, on Android app, it sets the variable value to 0 (erasing the previous established value).

I did the same test with a boolean variable, hoping the “led” example behavior, but it doesn’t work, I can set the variable in true, and after a refresh, the value return to false.

Don´t know if there are a way to get the variable value from the remote device and display it on android app, every time when the device’s page on android app is refreshed or closed and opened.

Thanks in advance.

I solved the issue (just dedicating a few minutes reading the forum, sorry)

when the variable is declared in “setup”, I did with this code and work perfectly for integer and boolean variable

thing["Variable 2"] << [](pson& in){ if(in.is_empty()){ in = variableInput2; }else{ variableInput2=in; }

Hi @ega! You can aslo define the resource as:

thing["Variable2"] << inputValue(variableInput2);

That will behave exactly as your code but cleaner :wink: