Automatically enable background mode when configuring a non sip.linphone.org account
This commit is contained in:
parent
3b24fcd097
commit
1c54678adc
1 changed files with 8 additions and 0 deletions
|
@ -24,6 +24,7 @@ import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||||
|
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||||
import org.linphone.core.*
|
import org.linphone.core.*
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
import org.linphone.utils.Event
|
import org.linphone.utils.Event
|
||||||
|
@ -134,6 +135,13 @@ class GenericLoginViewModel(private val accountCreator: AccountCreator) : ViewMo
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.i("[Assistant] [Generic Login] Proxy config created")
|
Log.i("[Assistant] [Generic Login] Proxy config created")
|
||||||
|
// The following is required to keep the app alive
|
||||||
|
// and be able to receive calls while in background
|
||||||
|
if (domain.value.orEmpty() != corePreferences.defaultDomain) {
|
||||||
|
Log.i("[Assistant] [Generic Login] Background mode with foreground service automatically enabled")
|
||||||
|
corePreferences.keepServiceAlive = true
|
||||||
|
coreContext.notificationsManager.startForeground()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isLoginButtonEnabled(): Boolean {
|
private fun isLoginButtonEnabled(): Boolean {
|
||||||
|
|
Loading…
Reference in a new issue