How to store pressed button information

Good morning Koders, I am building a very big app and it gets bigger every time I think I am finished. My app has a panic button as it is a security app but I would like to record the number of times the panic button gets pressed by all users and make these numbers available to be viewed by all users, so every time the button is pressed the last number gets updated with +1. I am already using tinyDB and Firebase to store profile information and other information but now I think I am stuck. Is there a way to do what I am asking? Thanks in advance…

new tag in firebase as “Panic” in root, whenever any user pressed button then get value of this tag .
after getting value, set this tag value to getValue + 1.in firebase.
before this procedure check for internet connectivity if false,then do this same process but in tinydb (tag Panic) and always check on screen initialize if connectivity is true,then above procedure for firebase but this time instead of adding 1 add value from tinydb tag Panic.

2 Likes

Thank you very much ShaikhSajidAli, I will try to implement this later on and tell you how it goes as right now I am busy with another online course.

image

And after that, just update the Firebase with whatever is in TinyDB at the moment.

2 Likes

This worked, thank you so much!

1 Like

Then mark solution

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.