[英]FireBase Admin SDK Java: Sending a notification
我正在嘗試使用我的 Java 服務器和 FireBase 管理員 ZF39676AZDAB6E543F0F39676AZDAB.
我可以從 FireBase 網站成功發送測試通知,但在我的服務器中的 Java 上設置它時遇到問題:
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();
}
我收到此錯誤:
線程“主”java.lang.IllegalArgumentException 中的異常:必須指定令牌、主題或條件之一
我什至在哪里設置用戶令牌? 我只想使用 Java 中的 FireBase 向我的 Android Z8908D47209EC5D9251D26 客戶端發送一個簡單的通知
只需將.setToken(...) 放在以下行之后: build())
我把它放錯地方了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.