From 11cda6f14a76b2e7871222b9af3b81a9df7ba6d2 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Mon, 23 Mar 2026 14:22:39 +0200 Subject: [PATCH] Update notification if it is dismissed --- .../kotlin/com/tutpro/baresip/BaresipService.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index ce970f88..ddd9d399 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -522,6 +522,10 @@ class BaresipService: Service() { toast(getString(R.string.no_aec), Toast.LENGTH_LONG) } + "Notification Dismissed" -> { + updateStatusNotification() + } + "Start Content Observer" -> { registerAndroidContactsObserver() } @@ -1471,10 +1475,19 @@ class BaresipService: Service() { .addCategory(Intent.CATEGORY_LAUNCHER) val pi = PendingIntent.getActivity(applicationContext, STATUS_REQ_CODE, intent, PendingIntent.FLAG_IMMUTABLE) + val deleteIntent = Intent(this, BaresipService::class.java) + .setAction("Notification Dismissed") + val dpi = PendingIntent.getService( + this, + STATUS_REQ_CODE, + deleteIntent, + PendingIntent.FLAG_IMMUTABLE + ) val notificationLayout = RemoteViews(packageName, R.layout.status_notification) snb.setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setSmallIcon(R.drawable.ic_notification_b) .setContentIntent(pi) + .setDeleteIntent(dpi) .setOngoing(true) .setStyle(NotificationCompat.DecoratedCustomViewStyle()) .setCustomContentView(notificationLayout)