I'm trying to send a notification to my Android device using my Java Server with the FireBase Admin SDK.
I can send test notifications from the FireBase website successfully, but I'm having trouble setting it up on Java in my server:
Message message = Message.builder()
.setNotification(Notification.builder()
.setTitle("$GOOG up 1.43% on the day")
.setBody("$GOOG gained 11.80 points to close at 835.67, up 1.43% on the day.")
.build())
.build();
// Send a message to the device corresponding to the provided
// registration token.
String response = "N/A";
try {
response = FirebaseMessaging.getInstance().send(message);
} catch (FirebaseMessagingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I get this error:
Exception in thread "main" java.lang.IllegalArgumentException: Exactly one of token, topic or condition must be specified
Where do I even set the user token here? I just want to send a simple notification using FireBase in Java to my Android FireBase client.