Realtime_DB AddListener + DataChanged is triggering even though the data hasn't changed

OK Guys, I have been dealing with this issue long enough, and I believe it is time to address it :see_no_evil:
The Realtime_DB Listener is not working as expected , and is triggering even thought there is not change in the Realtime_DB AddListener + DataChanged elements.

I have been trying I believe everything, even changing the rules with the same result, every time the page opens, where the Realtime_DB AddListener is located, the Realtime_DB DataChanged is triggered. But the most estrange or weirder thing is even if the if the action in the Realtime_DB DataChanged is inside an IF statement and this is FALSE , the action is triggered, for example I have this Realtime_DB DataChanged:


If I use this in the Realtime_DB AddListener when the screen starts:


every time my app starts, because that is my first screen, even in the Value is 0 the action is triggered, so the phone vibrates, and if I use Realtime_DB AddListener when the screen opens:


every time that screen opens, even if the value is 0 the action is triggered and the phone vibrates.

This is a really easy example of what i am doing with my app, but is really not working… I have tried with tons of different IF statements with no luck, is there any workaround to this guys? I really need your expertise here!!!.

In addition to this I also discovered that if you are using Tab Navigator, the Realtime_DB AddListener has to be in the same screen that the Realtime_DB DataChanged, otherwise wont work.

Cheers Thunkers!!!

1 Like

I believe you are comparing a string to a number. The green value block is probably a text string such as β€œ45”. A text string is never going to equal zero even if the text string happens to be β€œ0”. So you need to convert the text string to a number by adding zero to it:

If value+0 β‰  0
do vibrate


@tatiang , Than you so much, that was exactly what I my issue was!!! you can not imagine how dumb I am feeling right now, I am definitively familiar with comparing text against numbers, I even have used it in this project, and never before occurred to me this also could be the problem when you retrieve data from RealtimeDB . Thank you so much again!!!


You’re welcome! I’ve made many similar mistakes along the way. :smirk:


Thunkable number and text are NOT straight forward. Some Math function (X with Y decimal places) convert number to strings. Pulling numbers from data source (google sheets) also converts numbers to strings.

Assume Nothing. Everything is dirty, always, everywhere. We are all in this together.

Happy Thunking!


yes, we are