Notification with Firebase datachange event

I build an app that store datas on a firebase database. Different users can access to the database and read/write datas.
I would like to receive a notification if somebody has changed data.
I plan to do that by using the Firebase DataChanged event within the app and an extension for notification.
My problem is to identify a real datachanged event :slight_smile:
Within the app, each time a screen is intitialized DataChanged event is launch and is not a real change. How to do know if it's a real change or just a re-init from firebase ?
I read this post, but i didn't find the solution :grimacing:

Because my 'case' is a bit different, the changes comes from external (another user that will use the app on a other phone).
Thks for your help
Ps: by the way, in this post i've learned the right way to open/close different screen, super !

I guess all you can do is set a variable (e.g. true/false) when the screen initialises which can be tested as to whether to use the dataChanged information or not, then change the setting of the variable so that the dataChanges come through. Of course if the first one is a real one, yo may miss this.....

1 Like

Hi Tim,
Yes, you're right i will use a variable to exit the first datachanged, and then i will use the TAG from the firebase (return from the event) to check if it's a different user from the current user which is running the app.
Another question : Is the Event datachanged link to the screen ? I mean, should i copy the block for datachanged on all screen from my app ?

You will need the firebase component on every screen with the same connection details.

Much easier to use virtual screens....

Hi, sure. But my app is managing different Firedatabase (Set-Up, Result, Summary...) and if i design all screen in one i will be quickly lost ... and i will need BTW to code my block with a giant screen :grinning:

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