Generate sequential key with firebase

1

Good morning! I'm working on an app that saves some user activity and I'm having a problem saving these activities by generating sequential numbers, here's the environment: I have the user A logged in, it will create a new activity and when it saves it on the node ACTIVITIES it receives the id number 1, then user B saves another activity in another cell that will receive id 2, then user A saves a new one now with id 3 ... and so on ... Thank you!

    
asked by anonymous 20.09.2017 / 14:55

1 answer

-1

Use the method push() it does in sequence your data

database.child("dados").push().setValue(objeto);
    
21.09.2017 / 23:31