Fixed issue with foreground service & notifications

This commit is contained in:
Sylvain Berfini 2023-09-22 16:21:03 +02:00
parent f5a4922aa3
commit ad06f989b7
2 changed files with 13 additions and 2 deletions

View file

@ -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]"
}

View file

@ -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")
}
}