From ef759eb15e48517f666777a5674e1c2f85c949ba Mon Sep 17 00:00:00 2001 From: Alexander Bakker Date: Wed, 23 Nov 2022 14:46:42 +0100 Subject: [PATCH] Start NotificationService as a foreground service This should prevent the notification from remaining after the app has been killed by Android. Fixes #1037. --- .../beemdevelopment/aegis/services/NotificationService.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/com/beemdevelopment/aegis/services/NotificationService.java b/app/src/main/java/com/beemdevelopment/aegis/services/NotificationService.java index ed274a94..97ccc4a0 100644 --- a/app/src/main/java/com/beemdevelopment/aegis/services/NotificationService.java +++ b/app/src/main/java/com/beemdevelopment/aegis/services/NotificationService.java @@ -47,8 +47,7 @@ public class NotificationService extends Service { .setOngoing(true) .setContentIntent(pendingIntent); - NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this); - notificationManager.notify(NOTIFICATION_VAULT_UNLOCKED, builder.build()); + startForeground(NOTIFICATION_VAULT_UNLOCKED, builder.build()); } @Override