From ad06f989b7091867a09dcdd4f0656ebc043246a5 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 22 Sep 2023 16:21:03 +0200 Subject: [PATCH] Fixed issue with foreground service & notifications --- .../java/org/linphone/core/CoreForegroundService.kt | 4 ++-- .../linphone/notifications/NotificationsManager.kt | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/linphone/core/CoreForegroundService.kt b/app/src/main/java/org/linphone/core/CoreForegroundService.kt index 805c1b56b..f6b9d6312 100644 --- a/app/src/main/java/org/linphone/core/CoreForegroundService.kt +++ b/app/src/main/java/org/linphone/core/CoreForegroundService.kt @@ -19,15 +19,15 @@ */ package org.linphone.core -import android.app.Service import android.content.Intent import android.os.IBinder import androidx.annotation.MainThread import org.linphone.LinphoneApplication.Companion.coreContext import org.linphone.core.tools.Log +import org.linphone.core.tools.service.CoreService @MainThread -class CoreForegroundService : Service() { +class CoreForegroundService : CoreService() { companion object { private const val TAG = "[Core Foreground Service]" } diff --git a/app/src/main/java/org/linphone/notifications/NotificationsManager.kt b/app/src/main/java/org/linphone/notifications/NotificationsManager.kt index cc0234aae..155a8c9ae 100644 --- a/app/src/main/java/org/linphone/notifications/NotificationsManager.kt +++ b/app/src/main/java/org/linphone/notifications/NotificationsManager.kt @@ -97,12 +97,21 @@ class NotificationsManager @MainThread constructor(private val context: Context) ) { when (state) { Call.State.IncomingReceived, Call.State.IncomingEarlyMedia -> { + Log.i( + "$TAG Showing incoming call notification for [${call.remoteAddress.asStringUriOnly()}]" + ) showCallNotification(call, true) } Call.State.Connected -> { + Log.i( + "$TAG Showing connected call notification for [${call.remoteAddress.asStringUriOnly()}]" + ) showCallNotification(call, false) } Call.State.End, Call.State.Error -> { + Log.i( + "$TAG Removing terminated call notification for [${call.remoteAddress.asStringUriOnly()}]" + ) dismissCallNotification(call) } else -> { @@ -546,6 +555,8 @@ class NotificationsManager @MainThread constructor(private val context: Context) } catch (e: Exception) { Log.e("$TAG Exception occurred: $e") } + } else { + Log.w("$TAG POST_NOTIFICATIONS permission wasn't granted") } }