![](/img/trans.png)
[英]How to get the delivery status of the notification send to Device using Firebase Cloud functions?
[英]How to get the delivery status of notification from fcm in springboot?
下面是我在 spring 啟動時的代碼。
private void sendNotification(FCMMessageRequestDTO fcmMessageRequestDTO) {
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
headers.set("Authorization", fcmAuthorizationKey);
headers.add("Content-Type", "application/json");
RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
HttpEntity<FCMMessageRequestDTO> request = new HttpEntity<>(fcmMessageRequestDTO, headers);
restTemplate.postForObject(fcmMessageUrl, request, Object.class);
}
在這里我如何檢查通知發送到設備的狀態。
有人可以幫我解決這個問題嗎?
FCM 不再向您提供向設備發送通知的狀態。 它只會在您的 POST 請求的響應中確認 FCM 系統已收到消息。 將您的響應分配給一個變量並檢查 output。
String response = restTemplate.postForObject(fcmMessageUrl, request, Object.class);
System.out.println(response);
此外,我強烈建議您在項目中使用FCM 管理員 SDK 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.