I want to sent a message with the fcm of google but I need a class named "Message" but it doesn't exist with my imports. (I implemented com.google.firebase:firebase-messaging:18.0.0)
I tried using the remote message class but it doesn't fit to my problem.
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
I want to use this example code:
// 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);
The needed class is this: https://firebase.google.com/docs/reference/admin/java/reference/com/google/firebase/messaging/Message but it doesn't exist.