How to create a group chat with firebase in Android app

I am trying to create groups of some selected users in firebase.

But firebase creates a group of all users available in the firebase database. Is it possible to programmatically create a group of user lists (not all)? Any hint can be very helpful to me.

+3


source to share


1 answer


Try adding users to the group under a separate child. for example let's say one child contains all users and then create another root from your database which is a group.

root
 -users
  --user1
  --user2
  --user3
 -group1
  --user1
  --user10
 -group2
  --user5
  --user3

      



You can add these users to different groups by reading all users and then sorting them in different groups or when you create a user for the first time adding it to both users and any group.

+1


source







All Articles