fix push notification delivery on android
CI/CD / Backend Unit Tests (push) Successful in 2m16s
CI/CD / Deploy (push) Successful in 2m6s
CI/CD / Mobile Release (push) Successful in 22m0s

This commit is contained in:
2026-07-30 15:28:12 +02:00
parent ce01ab763c
commit 45e57181a9
8 changed files with 49 additions and 223 deletions
@@ -24,8 +24,20 @@ public class NotificationService {
for (DeviceToken token : tokens) {
// Include a notification block so Android's system tray displays it
// even when the app is killed/dozing (a data-only message is only
// ever shown by the app's own JS handler, which won't run when the
// OS has force-stopped the app). HIGH priority tells FCM to deliver
// promptly and wake the device out of Doze.
Message message = Message.builder()
.setToken(token.getFcmToken())
.setNotification(Notification.builder()
.setTitle(title)
.setBody(body)
.build())
.setAndroidConfig(AndroidConfig.builder()
.setPriority(AndroidConfig.Priority.HIGH)
.build())
.putData("title", title)
.putData("body", body)
.build();
@@ -74,6 +74,11 @@ public class SubjectService {
@Async
public void notifyAsync(Entry entry) {
// The scraper couldn't always match an announcement to a known subject, in
// which case there's nobody to notify. Guard against the NPE that would
// otherwise be thrown (and silently swallowed) on this async thread.
if (entry.getSubject() == null) return;
List<User> users =
userService.findUsersBySubjectId(entry.getSubject().getId());