Start foreground service when app starts if background mode is enabled
This commit is contained in:
parent
57e00931fc
commit
1d12c510ac
1 changed files with 3 additions and 0 deletions
|
@ -21,6 +21,7 @@ package org.linphone.core
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||||
|
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
import org.linphone.core.tools.service.CoreService
|
import org.linphone.core.tools.service.CoreService
|
||||||
|
|
||||||
|
@ -36,6 +37,8 @@ class CoreService : CoreService() {
|
||||||
if (intent?.extras?.get("StartForeground") == true) {
|
if (intent?.extras?.get("StartForeground") == true) {
|
||||||
Log.i("[Service] Starting as foreground")
|
Log.i("[Service] Starting as foreground")
|
||||||
coreContext.notificationsManager.startForeground(this, true)
|
coreContext.notificationsManager.startForeground(this, true)
|
||||||
|
} else if (corePreferences.keepServiceAlive) {
|
||||||
|
coreContext.notificationsManager.startForeground(this, false)
|
||||||
}
|
}
|
||||||
return super.onStartCommand(intent, flags, startId)
|
return super.onStartCommand(intent, flags, startId)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue