Skip to content

Commit 0efcedf

Browse files
authored
[Merge] #188 - 백그라운드 푸시 대응 위해 Notification 메시지 방식 적용
[Refactor] #188 - 백그라운드 푸시 대응 위해 Notification 메시지 방식 적용
2 parents 33d777a + ddcc435 commit 0efcedf

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/java/dgu/sw/global/fcm/service/FCMService.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@ public void sendMessage(String targetToken, String title, String body) {
1717
// 메시지 구성
1818
Message message = Message.builder()
1919
.setToken(targetToken)
20-
.putData("title", title)
21-
.putData("body", body)
20+
.setNotification(Notification.builder()
21+
.setTitle(title)
22+
.setBody(body)
23+
.build())
24+
.putData("type", "mocktest")
2225
.build();
2326

2427
// Firebase 메시지 전송
2528
String response = FirebaseMessaging.getInstance().send(message);
26-
log.info("FCM 메시지 전송 완료: {}", response);
29+
log.info("FCM 메시지 전송 완료: {}", response);
2730

2831
} catch (FirebaseMessagingException e) {
29-
log.error("FCM 메시지 전송 실패: {}", e.getMessage());
32+
log.error("FCM 메시지 전송 실패: {}", e.getMessage());
3033
throw new UserException(ErrorStatus._INTERNAL_SERVER_ERROR);
3134
}
3235
}

0 commit comments

Comments
 (0)