Stay organized with collections Save and categorize content based on your preferences.

CallControl

public final class CallControl
extends Object

java.lang.Object
   ↳ android.telecom.CallControl


CallControl provides client side control of a call. Each Call will get an individual CallControl instance in which the client can alter the state of the associated call.

Each method is Transactional meaning that it can succeed or fail. If a transaction succeeds, the OutcomeReceiver#onResult will be called by Telecom. Otherwise, the OutcomeReceiver#onError is called and provides a CallException that details why the operation failed.

Summary

Public methods

void disconnect(DisconnectCause disconnectCause, Executor executor, OutcomeReceiver<VoidCallException> callback)

Request Telecom disconnect the call and remove the call from telecom tracking.

ParcelUuid getCallId()
void requestCallEndpointChange(CallEndpoint callEndpoint, Executor executor, OutcomeReceiver<VoidCallException> callback)

Request a CallEndpoint change.

void setActive(Executor executor, OutcomeReceiver<VoidCallException> callback)

Request Telecom set the call state to active.

void setInactive(Executor executor, OutcomeReceiver<VoidCallException> callback)

Request Telecom set the call state to inactive.

void startCallStreaming(Executor executor, OutcomeReceiver<VoidCallException> callback)

Request start a call streaming session.

Inherited methods

Public methods

disconnect

public void disconnect (DisconnectCause disconnectCause, 
                Executor executor, 
                OutcomeReceiver<VoidCallException> callback)

Request Telecom disconnect the call and remove the call from telecom tracking.

Parameters
disconnectCause DisconnectCause: represents the cause for disconnecting the call. The only valid codes for the DisconnectCause passed in are: This value cannot be null.

executor Executor: The Executor on which the OutcomeReceiver callback will be called on. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread. This value cannot be null.

callback OutcomeReceiver: That will be completed on the Telecom side that details success or failure of the requested operation. OutcomeReceiver#onResult will be called if Telecom has successfully disconnected the call. OutcomeReceiver#onError will be called if Telecom has failed to disconnect the call. A CallException will be passed that details why the operation failed.

Note: After the call has been successfully disconnected, calling any CallControl API will result in the OutcomeReceiver#onError with CallException#CODE_CALL_IS_NOT_BEING_TRACKED. This value cannot be null.

getCallId

public ParcelUuid getCallId ()

Returns
ParcelUuid the callId Telecom assigned to this CallControl object which should be attached to an individual call. This value cannot be null.

requestCallEndpointChange

public void requestCallEndpointChange (CallEndpoint callEndpoint, 
                Executor executor, 
                OutcomeReceiver<VoidCallException> callback)

Request a CallEndpoint change. Clients should not define their own CallEndpoint when requesting a change. Instead, the new endpoint should be one of the valid endpoints provided by CallEventCallback#onAvailableCallEndpointsChanged(List).

Parameters
callEndpoint CallEndpoint: The CallEndpoint to change to. This value cannot be null.

executor Executor: The Executor on which the OutcomeReceiver callback will be called on. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread. This value cannot be null.

callback OutcomeReceiver: The OutcomeReceiver that will be completed on the Telecom side that details success or failure of the requested operation. OutcomeReceiver#onResult will be called if Telecom has successfully changed the CallEndpoint that was requested. OutcomeReceiver#onError will be called if Telecom has failed to switch to the requested CallEndpoint. A CallException will be passed that details why the operation failed. This value cannot be null.

setActive

public void setActive (Executor executor, 
                OutcomeReceiver<VoidCallException> callback)

Request Telecom set the call state to active.

Parameters
executor Executor: The Executor on which the OutcomeReceiver callback will be called on. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread. This value cannot be null.

callback OutcomeReceiver: that will be completed on the Telecom side that details success or failure of the requested operation. OutcomeReceiver#onResult will be called if Telecom has successfully switched the call state to active OutcomeReceiver#onError will be called if Telecom has failed to set the call state to active. A CallException will be passed that details why the operation failed. This value cannot be null.

setInactive

public void setInactive (Executor executor, 
                OutcomeReceiver<VoidCallException> callback)

Request Telecom set the call state to inactive. This the same as hold for two call endpoints but can be extended to setting a meeting to inactive.

Parameters
executor Executor: The Executor on which the OutcomeReceiver callback will be called on. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread. This value cannot be null.

callback OutcomeReceiver: that will be completed on the Telecom side that details success or failure of the requested operation. OutcomeReceiver#onResult will be called if Telecom has successfully switched the call state to inactive OutcomeReceiver#onError will be called if Telecom has failed to set the call state to inactive. A CallException will be passed that details why the operation failed. This value cannot be null.

startCallStreaming

public void startCallStreaming (Executor executor, 
                OutcomeReceiver<VoidCallException> callback)

Request start a call streaming session. On receiving valid request, telecom will bind to the CallStreamingService implemented by a general call streaming sender. So that the call streaming sender can perform streaming local device audio to another remote device and control the call during streaming.

Parameters
executor Executor: The Executor on which the OutcomeReceiver callback will be called on. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread. This value cannot be null.

callback OutcomeReceiver: that will be completed on the Telecom side that details success or failure of the requested operation. OutcomeReceiver#onResult will be called if Telecom has successfully started the call streaming. OutcomeReceiver#onError will be called if Telecom has failed to start the call streaming. A CallException will be passed that details why the operation failed. This value cannot be null.