Display firebase data time to time

Hi...I want retrieve the value under "detect". If the value is 1, it means the power cable is cut...so the app sends warning through call.
image

image
At the same time, i want the app keep updating the data with date and time. And i keep getting as image below.

Becuase you are taking the label text and comparing
image

what should i take then?

can you please continue the talk as i also want to get value from firebase in background.