mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Fixed issue with foreground service & notifications
This commit is contained in:
parent
f5a4922aa3
commit
ad06f989b7
2 changed files with 13 additions and 2 deletions
|
|
@ -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]"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue