Prevent crash in TelecomHelper if android.software.connectionservice feature isn't supported by device
This commit is contained in:
parent
8515e2fcaf
commit
47c0dbf842
1 changed files with 9 additions and 3 deletions
|
@ -30,7 +30,7 @@ import android.telecom.PhoneAccount
|
||||||
import android.telecom.PhoneAccountHandle
|
import android.telecom.PhoneAccountHandle
|
||||||
import android.telecom.TelecomManager
|
import android.telecom.TelecomManager
|
||||||
import android.telecom.TelecomManager.*
|
import android.telecom.TelecomManager.*
|
||||||
import java.lang.Exception
|
import kotlin.Exception
|
||||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||||
import org.linphone.R
|
import org.linphone.R
|
||||||
import org.linphone.core.Call
|
import org.linphone.core.Call
|
||||||
|
@ -180,8 +180,14 @@ class TelecomHelper private constructor(context: Context) {
|
||||||
.setSupportedUriSchemes(listOf(PhoneAccount.SCHEME_SIP))
|
.setSupportedUriSchemes(listOf(PhoneAccount.SCHEME_SIP))
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
try {
|
||||||
telecomManager.registerPhoneAccount(account)
|
telecomManager.registerPhoneAccount(account)
|
||||||
Log.i("[Telecom Helper] Phone account created: $account")
|
Log.i("[Telecom Helper] Phone account created: $account")
|
||||||
|
} catch (uoe: UnsupportedOperationException) {
|
||||||
|
Log.e("[Telecom Helper] Unsupported Operation Exception: $uoe")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e("[Telecom Helper] Exception: $e")
|
||||||
|
}
|
||||||
return account
|
return account
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue