I’m having a little problem with an app of mine here, and I need your help please.
I have this block where I store data in firebase. And for each user is generated a specific database.
But what’s the matter?
It is as follows: I created a logic, not to reflect the same name (tag). And this is working, but a bug. Every time I enter the app, and put the same name it already has in the database, it stores the new data over what it already has. But when I put the same name a second time, the app works, it won’t let me store the same name.
When I enter the app, and type the same resident name (tag) it replaces what already has in the database. But when I enter the same resident name again (tag) he accuses that the same name already exists.
The problem is this: because when I type the same name that already exists in firebase, it replaces, and the second time he accuses that name already exists?
I have in firebase these tags:
IGOR
IVAN SILVA
PAULO
PEDRO
In a new registration, when entering these same tags, the value is replaced, but when I enter the second time the same tag the app, will work correctly, saying that the name already exists.
The app is designed to include data, and the app won’t let me record repeated names. So far so good!
But what happens is: when I enter the app, and I will store name that already exists in the database (firebase) it is storing (replacing) on top of what already exists there. What is not to do.
When I will save the same name again, a notification appears saying that the name already exists.
But the app was supposed to do this the first time I try to save data.
It seems to be, that if you save a data onto firebase, it overrides an existing data. You said, that this is not allowed to happen. This works, when data is stored first time and tries to save second time while app is still running. but if you close the app and restart the app, you can store a data that already exist.
so it seems to be, that the app doesn’t get the info, that the data to store already exists or that the app has to check before.
Maybe there is a block “check, if data exists already” but this block is not addressed at the expected moment.
As I read the blocks, the list “globalListaTags” is deleted after they have been saved in Firebase_DB1.
That means next time the new entry of the user should NOT be in the list, since it is empty again.
Do you know what I mean: First time you add an item, it is not in list. so the block ELSE is going on.
In the ELSE block you delete all data from this list. so next time the item is not in list again and the ELSE block is going on.