Added in API level 34

CallControlCallback


interface CallControlCallback
android.telecom.CallControlCallback

CallControlCallback relays call updates (that require a response) from the Telecom framework out to the application.This can include operations which the app must implement on a Call due to the presence of other calls on the device, requests relayed from a Bluetooth device, or from another calling surface.

All CallControlCallbacks are transactional, meaning that a client must complete the Consumer via Consumer#accept(Object) in order to complete the CallControlCallbacks. If a CallControlCallbacks can be completed, the Consumer#accept(Object) should be called with Boolean#TRUE. Otherwise, Consumer#accept(Object) should be called with Boolean#FALSE to represent the CallControlCallbacks cannot be completed on the client side.

Note: Each CallEventCallback has a timeout of 5000 milliseconds. Failing to complete the Consumer before the timeout will result in a failed transaction.

Summary

Public methods
abstract Unit
onAnswer(videoState: Int, wasCompleted: Consumer<Boolean!>)

Telecom is informing the client to answer an incoming call and set it to active.

abstract Unit

Telecom is informing the client to set the call in streaming.

abstract Unit
onDisconnect(disconnectCause: DisconnectCause, wasCompleted: Consumer<Boolean!>)

Telecom is informing the client to disconnect the call

abstract Unit
onSetActive(wasCompleted: Consumer<Boolean!>)

Telecom is informing the client to set the call active

abstract Unit
onSetInactive(wasCompleted: Consumer<Boolean!>)

Telecom is informing the client to set the call inactive.

Public methods

onAnswer

Added in API level 34
abstract fun onAnswer(
    videoState: Int,
    wasCompleted: Consumer<Boolean!>
): Unit

Telecom is informing the client to answer an incoming call and set it to active.

Parameters
videoState Int: the video state Value is android.telecom.CallAttributes#AUDIO_CALL, or android.telecom.CallAttributes#VIDEO_CALL
wasCompleted Consumer<Boolean!>: The Consumer to be completed. If the client can answer the call on their end, Consumer#accept(Object) should be called with Boolean#TRUE. Otherwise,Consumer#accept(Object) should be called with Boolean#FALSE. However, Telecom will still disconnect the call and remove it from tracking. This value cannot be null.

onCallStreamingStarted

Added in API level 34
abstract fun onCallStreamingStarted(wasCompleted: Consumer<Boolean!>): Unit

Telecom is informing the client to set the call in streaming.

Parameters
wasCompleted Consumer<Boolean!>: The Consumer to be completed. If the client can stream the call on their end, Consumer#accept(Object) should be called with Boolean#TRUE. Otherwise, Consumer#accept(Object) should be called with Boolean#FALSE. This value cannot be null.

onDisconnect

Added in API level 34
abstract fun onDisconnect(
    disconnectCause: DisconnectCause,
    wasCompleted: Consumer<Boolean!>
): Unit

Telecom is informing the client to disconnect the call

Parameters
disconnectCause DisconnectCause: represents the cause for disconnecting the call. This value cannot be null.
wasCompleted Consumer<Boolean!>: The Consumer to be completed. If the client can disconnect the call on their end, Consumer#accept(Object) should be called with Boolean#TRUE. Otherwise,Consumer#accept(Object) should be called with Boolean#FALSE. However, Telecom will still disconnect the call and remove it from tracking. This value cannot be null.

onSetActive

Added in API level 34
abstract fun onSetActive(wasCompleted: Consumer<Boolean!>): Unit

Telecom is informing the client to set the call active

Parameters
wasCompleted Consumer<Boolean!>: The Consumer to be completed. If the client can set the call active on their end, the Consumer#accept(Object) should be called with Boolean#TRUE. Otherwise, Consumer#accept(Object) should be called with Boolean#FALSE. Telecom will effectively ignore the remote setActive request and the call will remain in whatever state it is in. This value cannot be null.

onSetInactive

Added in API level 34
abstract fun onSetInactive(wasCompleted: Consumer<Boolean!>): Unit

Telecom is informing the client to set the call inactive. This is the same as holding a call for two endpoints but can be extended to setting a meeting inactive.

Parameters
wasCompleted Consumer<Boolean!>: The Consumer to be completed. If the client can set the call inactive on their end, the Consumer#accept(Object) should be called with Boolean#TRUE. Otherwise, Consumer#accept(Object) should be called with Boolean#FALSE. Telecom will effectively ignore the remote setInactive request and the call will remain in whatever state it is in. This value cannot be null.