4

I've been building a standalone calling app in Android Studio with Kotlin following this tutorial: https://developer.android.com/guide/topics/connectivity/telecom/selfManaged

I've implemented everything that's necessary and read the whole docs a few times over, yet still I can't make my code work. The problem I am having is answering incoming calls and making outgoing calls.

Incoming calls: According to the Logcat, every function is called in correct order. However, I always get the following information when there's an incoming call:

I/TelecomFramework: CallHandler: reject TC@71_1: (...->CSW.hCCC)->CS.r->H.CS.r(cet/cast/cast)@E-E-E-Bn0

I/TelecomFramework: CallHandler: notifyCreateConnectionComplete TC@71_1: (...->CSW.hCCC)->CS.crCoC->H.CS.crCoC(cet/cast)@E-E-E-Bn0

CallHandler is one of the classes that I've implemented and it extends ConnectionService. There's no function or command within that class that rejects the call (as shown in the info). When I try to answer my call with call.answer() or connection.setActive(), the app crashes without any error message. I've tried debugging and everything else that came to my mind but I can't find a solution.

Outgoing calls: I really don't know why this doesn't work, it just seems like the connection isn't even built. Every function is called in correct order once again and I don't get any error messages. I get the following informations though:

I/TelecomFramework: CallHandler: notifyCreateConnectionComplete TC@173_1: (...->CSW.hCCC)->CS.crCoC->H.CS.crCoC(cast)@E-E-E-gX

I/TelecomFramework: CallHandler: onAudioStateChanged TC@173_1 [AudioState isMuted: false, route: EARPIECE, supportedRouteMask: EARPIECE, SPEAKER, activeBluetoothDevice: [null], supportedBluetoothDevices: []]: CS.cASC->H.CS.cASC@AAE

Here's the CallHandler class:

class CallHandler : ConnectionService(){

    @RequiresApi(Build.VERSION_CODES.O)
    override fun onCreateOutgoingConnection(
        connectionManagerPhoneAccount: PhoneAccountHandle?,
        request: ConnectionRequest?
    ): Connection {
        //return super.onCreateOutgoingConnection(connectionManagerPhoneAccount, request)

        val callConnection = CallConnection(applicationContext)

        callConnection.setInitializing()
        callConnection.setInitialized()
        callConnection.setDialing()
        callConnection.setActive()

        Log.i("CallHandler", "onCreateOutgoingConnection called")

        return callConnection
    }


    @RequiresApi(Build.VERSION_CODES.O)
    override fun onCreateIncomingConnection(
        connectionManagerPhoneAccount: PhoneAccountHandle?,
        request: ConnectionRequest?
    ): Connection {
      //  super.onCreateIncomingConnection(connectionManagerPhoneAccount, request)

        val callConnection = CallConnection(applicationContext)
        callConnection.setRinging()
        callConnection.setInitializing()
        Log.i("CallHandler", "onCreateIncomingConnection Called")

        return callConnection
    }

I've removed the onCreateIncomingConnectionFailed(and outgoing) functions as all they do is show a toast. CallConnection() is the class that extends connectionand sets connectionProperties = PROPERTY_SELF_MANAGED in its init.

I'd really appreciate any help. I've been looking for the problem for multiple days now without finding the reason or a solution.

JakZ
  • 61
  • 1
  • 4

0 Answers0