Skip to content

Commit

Permalink
fix: #457 절전모드에서도 알림을 받을 수 있도록 수정 (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonyj1022 authored and swonny committed Oct 6, 2023
1 parent d1f4fee commit 739deee
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.ddang.ddang.device.domain.DeviceToken;
import com.ddang.ddang.device.infrastructure.persistence.JpaDeviceTokenRepository;
import com.ddang.ddang.notification.application.dto.CreateNotificationDto;
import com.google.firebase.messaging.AndroidConfig;
import com.google.firebase.messaging.FirebaseMessaging;
import com.google.firebase.messaging.FirebaseMessagingException;
import com.google.firebase.messaging.Message;
Expand Down Expand Up @@ -44,13 +45,17 @@ private String makeAndSendMessage(
final CreateNotificationDto createNotificationDto,
final DeviceToken deviceToken
) {
final AndroidConfig androidConfig = AndroidConfig.builder()
.setPriority(AndroidConfig.Priority.HIGH)
.build();
final Message message = Message.builder()
.setToken(deviceToken.getDeviceToken())
.putData(NOTIFICATION_TYPE.getKeyName(), createNotificationDto.notificationType().getValue())
.putData(IMAGE.getKeyName(), createNotificationDto.image())
.putData(TITLE.getKeyName(), createNotificationDto.title())
.putData(BODY.getKeyName(), createNotificationDto.body())
.putData(REDIRECT_URL.getKeyName(), createNotificationDto.redirectUrl())
.setAndroidConfig(androidConfig)
.build();

try {
Expand Down

0 comments on commit 739deee

Please sign in to comment.