From 9e52522ffdc63e37ab0ea06042ee4c9cad1409c6 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Mon, 9 May 2022 07:49:15 +0300 Subject: [PATCH] Do not play notification sound in DND mode --- app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index 829e0ff3..b4b84637 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -1015,7 +1015,11 @@ class BaresipService: Service() { nm.notify(MESSAGE_NOTIFICATION_ID, nb.build()) return } - nt.play() + if (VERSION.SDK_INT >= 23) { + if (nm.currentInterruptionFilter <= NotificationManager.INTERRUPTION_FILTER_ALL) + nt.play() + } else + nt.play() postServiceEvent(ServiceEvent("message show", arrayListOf(uap, peer), System.nanoTime())) }