I'm following a tutorial for Cloud Messaging Messaging here https://firebase.google.com/docs/cloud-messaging/send-message#send_messages_to_specific_devices and I'm having trouble constructing the Message object.
When I try to send the message using the code below and run my app I am receiving the following compile error "Type mismatch: inferred type is Message but RemoteMessage was expected". It is telling me to pass a RemoteMessage instead of a Message but the send() parameter clearly states otherwise.
I'm also using the Firebase Admin SDK and finding it difficult to send a notification to a device programatically instead of the console notification composer. I really appreciate any help in advance!
// See documentation on defining a message payload.
val 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.
FirebaseMessaging.getInstance().send(message)