2

enter image description here

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

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

1 Answers1

0

You need an firebase token of the device which receive notification