fix: set NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE to avoid delays

This commit is contained in:
Tam Nguyen
2025-12-19 22:29:31 +11:00
parent 98a5b1fb32
commit a53e05645c

View File

@@ -48,6 +48,7 @@ class LockTaskService: Service() {
.setSmallIcon(R.drawable.lock_fill0) .setSmallIcon(R.drawable.lock_fill0)
.addAction(NotificationCompat.Action.Builder(null, getString(R.string.stop), pendingIntent).build()) .addAction(NotificationCompat.Action.Builder(null, getString(R.string.stop), pendingIntent).build())
.setOngoing(true) .setOngoing(true)
.setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE)
.build() .build()
ServiceCompat.startForeground( ServiceCompat.startForeground(
this, NotificationType.LockTaskMode.id, notification, this, NotificationType.LockTaskMode.id, notification,