Reputation:
I successfully manage to create a one on one private chat using this structure
message {
User1 {
User2 {
message1 {
from: User1
message: "Hi User One"
seen: true
time: (timeInMills)
type: text
}
}
}
User2 {
User1 {
message1 {
from: User1
message: "Hi User One"
seen: true
time: (timeInMills)
type: text
}
}
}
}
and now I'm planning to create a group chat that stores the same properties but unfornately I'm having a hard time to create a structure. Can someone give me an idea on creating a group chat structure
Upvotes: 1
Views: 2304
Reputation: 80914
Try this:
Messages
groupchat1
userid
message:hello
time: (timeinMills)
type: text
userid1
message: hello again!
time (timeinMills)
type: text
groupchat1
will be the name of the chatting group, it will contain the users that are inside that chat and messaging each other. Then you can retrieve the messages using FirebaseRecyclerAdapter
Upvotes: 1