【问题标题】:Unable to send notification message to all the participants of the group in firebase无法向 Firebase 中组的所有参与者发送通知消息
【发布时间】:2019-11-01 22:25:10
【问题描述】:

我正在创建群聊应用程序,当用户在该组中发送一些消息时,我想在其中向该组的所有参与者发送新到达消息的通知。

我已尝试存储设备令牌并向他们发送消息

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("");



}

这里我点击发送按钮发送消息

【问题讨论】:

标签: java android firebase firebase-realtime-database


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-31
    • 1970-01-01
    • 1970-01-01
    • 2020-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多