Start NotificationService as a foreground service

This should prevent the notification from remaining after the app has
been killed by Android.

Fixes #1037.
This commit is contained in:
Alexander Bakker 2022-11-23 14:46:42 +01:00
parent f8d89d5754
commit ef759eb15e

View file

@ -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