| Line 2636... |
Line 2636... |
| 2636 |
sender.send(message);
|
2636 |
sender.send(message);
|
| 2637 |
}
|
2637 |
}
|
| 2638 |
|
2638 |
|
| 2639 |
public void sendNotification() throws Exception {
|
2639 |
public void sendNotification() throws Exception {
|
| 2640 |
LOGGER.info("FCM sendNotification");
|
2640 |
LOGGER.info("FCM sendNotification");
|
| 2641 |
List<PushNotifications> pushNotifications = pushNotificationRepository.selectPendingNotifications(500);
|
2641 |
List<PushNotifications> pushNotifications = pushNotificationRepository.selectAllPendingNotifications();
|
| 2642 |
if (!pushNotifications.isEmpty()) {
|
2642 |
if (!pushNotifications.isEmpty()) {
|
| 2643 |
InputStream serviceAccount = getClass().getClassLoader().getResourceAsStream("service-account.json");
|
2643 |
InputStream serviceAccount = getClass().getClassLoader().getResourceAsStream("service-account.json");
|
| 2644 |
GoogleCredentials googleCredentials = GoogleCredentials.fromStream(serviceAccount).createScoped(FCM_SCOPED);
|
2644 |
GoogleCredentials googleCredentials = GoogleCredentials.fromStream(serviceAccount).createScoped(FCM_SCOPED);
|
| 2645 |
googleCredentials.refreshIfExpired();
|
2645 |
googleCredentials.refreshIfExpired();
|
| 2646 |
String accessToken = googleCredentials.getAccessToken().getTokenValue();
|
2646 |
String accessToken = googleCredentials.getAccessToken().getTokenValue();
|