【问题标题】:Firebase Admin FCM Send Messages doesnt workFirebase 管理员 FCM 发送消息不起作用
【发布时间】:2018-11-08 15:35:41
【问题描述】:

我完全按照描述的那样做 https://firebase.google.com/docs/cloud-messaging/admin/send-messages

我的代码:

Message message = Message.builder()
    .putData("title", "850")
    .putData("body", "2:45")
    .setTopic("topic")
    .build();

String response = FirebaseMessaging.getInstance().send(message);
System.out.println("Successfully sent message: " + response);

结果:

成功发送消息: 项目/gcm-1234/messages/5525078879722149927

但是当我去的时候: https://console.firebase.google.com/project/gcm-1234/notification

我没有看到任何新消息,我也没有在手机上收到消息,但是当我从 firebase 控制台发送消息时,它也可以在手机上运行。

在哪里可以找到这条消息?为什么它不起作用?

【问题讨论】:

    标签: node.js firebase firebase-cloud-messaging firebase-admin


    【解决方案1】:
    Where I can find this message? 
    

    即使消息已正确发送。它不会出现在 Firebase 控制台中。这就是它的设计方式。

    为什么它不起作用?

    要发送通知,有效负载必须使用通知键:

    .setNotification(new Notification("test","test"))};
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-17
      • 1970-01-01
      • 1970-01-01
      • 2019-06-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多