I am creating group chat application in which I want to send notification for newly arrived messages to all the participants of that group when a user send some message in that group.
I have tried storing the device token and sending the them messages
private void sendMessage(String sender, final String receiver) {
DatabaseReference reference = FirebaseDatabase.getInstance().getReference();
FirebaseDatabase.getInstance()
.getReference().child("Chatts").child("Groups").child(group_name).child("Messages")
.push()
.setValue(new ChatMessage(input.getText().toString(),
FirebaseAuth.getInstance().getCurrentUser().getEmail(),
FirebaseAuth.getInstance().getCurrentUser().getUid())
);
input.setText("");
}
Here I send the message on click of send button