adding some outgoing call related things

This commit is contained in:
tibbi 2018-11-28 14:01:37 +01:00
parent bf981e1033
commit 4800ac3573
1 changed files with 15 additions and 4 deletions

View File

@ -137,11 +137,22 @@ class DialerActivity : SimpleActivity(), SensorEventListener {
dialer_label.setText(if (isIncomingCall) R.string.incoming_call_from else R.string.calling)
}
@SuppressLint("MissingPermission")
private fun initOutgoingCall() {
val telecomManager = getSystemService(Context.TELECOM_SERVICE) as TelecomManager
val uri = Uri.fromParts(PhoneAccount.SCHEME_TEL, callNumber, null)
val extras = Bundle()
telecomManager.placeCall(uri, extras)
try {
val telecomManager = getSystemService(Context.TELECOM_SERVICE) as TelecomManager
val uri = Uri.fromParts(PhoneAccount.SCHEME_TEL, callNumber, null)
Bundle().apply {
putParcelable(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, telecomManager.getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL))
putBoolean(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, false)
putBoolean(TelecomManager.EXTRA_START_CALL_WITH_SPEAKERPHONE, false)
telecomManager.placeCall(uri, this)
}
callStatus = Call.STATE_DIALING
} catch (e: Exception) {
showErrorToast(e)
finish()
}
}
private fun startNotificationService() {