简体   繁体   English

无法向Firebase中的所有参与者发送通知消息

[英]Unable to send notification message to all the participants of the group in firebase

在此处输入图片说明

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 在这里,我点击“发送”按钮发送消息

您需要接收通知的设备的Firebase令牌

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM