我正在使用 fcm 从我的 Android 应用程序发送通知,并且我已经实现了它要求我提供的所有库。
val topic = "highScores"
// See documentation on defining a message payload.
val message = Message.builder()
.putData("score", "850")
.putData("time", "2:45")
.setTopic(topic)
.build()
// Send a message to the devices subscribed to the provided topic.
val response = FirebaseMessaging.getInstance().send(message)
// Response is a message ID string.
println("Successfully sent message: " + response)
我正在使用此代码发送通知,但构建器显示未解决。
最佳答案
将其添加到您的依赖项
implementation 'com.google.firebase:firebase-admin:6.9.0'
并确保导入正确的 Message 类,即
import com.google.firebase.messaging.Message
关于android - 在 Message.builder 中, builder() 显示未解析的引用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54827397/