Added in API level 34

CallControlCallback


public 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 void onAnswer(int videoState, Consumer<Boolean> wasCompleted)

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

abstract void onCallStreamingStarted(Consumer<Boolean> wasCompleted)

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

abstract void onDisconnect(DisconnectCause disconnectCause, Consumer<Boolean> wasCompleted)

Telecom is informing the client to disconnect the call

abstract void onSetActive(Consumer<Boolean> wasCompleted)

Telecom is informing the client to set the call active

abstract void onSetInactive(Consumer<Boolean> wasCompleted)

Telecom is informing the client to set the call inactive.

Public methods

onAnswer

Added in API level 34
public abstract void onAnswer (int videoState, 
                Consumer<Boolean> wasCompleted)

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

Parameters
videoState int: the video state Value is CallAttributes.AUDIO_CALL, or CallAttributes.VIDEO_CALL

wasCompleted Consumer: 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
public abstract void onCallStreamingStarted (Consumer<Boolean> wasCompleted)

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

Parameters
wasCompleted Consumer: 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
public abstract void onDisconnect (DisconnectCause disconnectCause, 
                Consumer<Boolean> wasCompleted)

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: 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
public abstract void onSetActive (Consumer<Boolean> wasCompleted)

Telecom is informing the client to set the call active

Parameters
wasCompleted Consumer: 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
public abstract void onSetInactive (Consumer<Boolean> wasCompleted)

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: 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.