【发布时间】:2021-02-28 18:15:03
【问题描述】:
我正在关注guide 向某些设备发送消息。 关于构建发送请求的部分,它说:
// The topic name can be optionally prefixed with "/topics/".
String topic = "highScores";
// See documentation on defining a message payload.
Message message = Message.builder()
.putData("score", "850")
.putData("time", "2:45")
.setTopic(topic)
.build();
// Send a message to the devices subscribed to the provided topic.
String response = FirebaseMessaging.getInstance().send(message);
// Response is a message ID string.
System.out.println("Successfully sent message: " + response);
当我尝试导入 Message 类时,IDE 告诉我没有库,为什么?
也许它已被弃用但文档尚未更新?
谢谢
【问题讨论】:
标签: java android firebase firebase-cloud-messaging firebase-notifications