Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# CallControlCallback

*** ** * ** ***

` public interface CallControlCallback `   
` `

|---|
| android.telecom.CallControlCallback |

<br />

*** ** * ** ***

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 `https://developer.android.com/reference/java/util/function/Consumer` via `https://developer.android.com/reference/java/util/function/Consumer#accept(T)` in order to complete the CallControlCallbacks. If a CallControlCallbacks can be completed, the `https://developer.android.com/reference/java/util/function/Consumer#accept(T)` should be called with `https://developer.android.com/reference/java/lang/Boolean#TRUE`. Otherwise, `https://developer.android.com/reference/java/util/function/Consumer#accept(T)` should be called with `https://developer.android.com/reference/java/lang/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 `https://developer.android.com/reference/java/util/function/Consumer` before the timeout will result in a failed transaction.

## Summary

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/telecom/CallControlCallback#onAnswer(int,%20java.util.function.Consumer<java.lang.Boolean>)(int videoState, https://developer.android.com/reference/java/util/function/Consumer<https://developer.android.com/reference/java/lang/Boolean> wasCompleted) ` Telecom is informing the client to answer an incoming call and set it to active. |
| ` abstract void` | ` https://developer.android.com/reference/android/telecom/CallControlCallback#onCallStreamingStarted(java.util.function.Consumer<java.lang.Boolean>)(https://developer.android.com/reference/java/util/function/Consumer<https://developer.android.com/reference/java/lang/Boolean> wasCompleted) ` Telecom is informing the client to set the call in streaming. |
| ` abstract void` | ` https://developer.android.com/reference/android/telecom/CallControlCallback#onDisconnect(android.telecom.DisconnectCause,%20java.util.function.Consumer<java.lang.Boolean>)(https://developer.android.com/reference/android/telecom/DisconnectCause disconnectCause, https://developer.android.com/reference/java/util/function/Consumer<https://developer.android.com/reference/java/lang/Boolean> wasCompleted) ` Telecom is informing the client to disconnect the call |
| ` abstract void` | ` https://developer.android.com/reference/android/telecom/CallControlCallback#onSetActive(java.util.function.Consumer<java.lang.Boolean>)(https://developer.android.com/reference/java/util/function/Consumer<https://developer.android.com/reference/java/lang/Boolean> wasCompleted) ` Telecom is informing the client to set the call active |
| ` abstract void` | ` https://developer.android.com/reference/android/telecom/CallControlCallback#onSetInactive(java.util.function.Consumer<java.lang.Boolean>)(https://developer.android.com/reference/java/util/function/Consumer<https://developer.android.com/reference/java/lang/Boolean> wasCompleted) ` Telecom is informing the client to set the call inactive. |

## Public methods

### onAnswer

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onAnswer (int videoState, 
                Consumer<Boolean> wasCompleted)
```

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

<br />

| Parameters ||
|---|---|
| `videoState` | `int`: the video state. Value is one of the following: - `https://developer.android.com/reference/android/telecom/CallAttributes#AUDIO_CALL` - `https://developer.android.com/reference/android/telecom/CallAttributes#VIDEO_CALL` - `https://developer.android.com/reference/android/telecom/CallAttributes#MESSAGING` |
| `wasCompleted` | `Consumer`: The `https://developer.android.com/reference/java/util/function/Consumer` to be completed. If the client can answer the call on their end, `https://developer.android.com/reference/java/util/function/Consumer#accept(T)` should be called with `https://developer.android.com/reference/java/lang/Boolean#TRUE`. Otherwise,`https://developer.android.com/reference/java/util/function/Consumer#accept(T)` should be called with `https://developer.android.com/reference/java/lang/Boolean#FALSE`. However, Telecom will still disconnect the call and remove it from tracking. This value cannot be `null`. <br /> |

### onCallStreamingStarted

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onCallStreamingStarted (Consumer<Boolean> wasCompleted)
```

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

<br />

| Parameters ||
|---|---|
| `wasCompleted` | `Consumer`: The `https://developer.android.com/reference/java/util/function/Consumer` to be completed. If the client can stream the call on their end, `https://developer.android.com/reference/java/util/function/Consumer#accept(T)` should be called with `https://developer.android.com/reference/java/lang/Boolean#TRUE`. Otherwise, `https://developer.android.com/reference/java/util/function/Consumer#accept(T)` should be called with `https://developer.android.com/reference/java/lang/Boolean#FALSE`. This value cannot be `null`. <br /> |

### onDisconnect

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

Telecom is informing the client to disconnect the call

<br />

| Parameters ||
|---|---|
| `disconnectCause` | `DisconnectCause`: represents the cause for disconnecting the call. This value cannot be `null`. <br /> |
| `wasCompleted` | `Consumer`: The `https://developer.android.com/reference/java/util/function/Consumer` to be completed. If the client can disconnect the call on their end, `https://developer.android.com/reference/java/util/function/Consumer#accept(T)` should be called with `https://developer.android.com/reference/java/lang/Boolean#TRUE`. Otherwise,`https://developer.android.com/reference/java/util/function/Consumer#accept(T)` should be called with `https://developer.android.com/reference/java/lang/Boolean#FALSE`. However, Telecom will still disconnect the call and remove it from tracking. This value cannot be `null`. <br /> |

### onSetActive

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onSetActive (Consumer<Boolean> wasCompleted)
```

Telecom is informing the client to set the call active

<br />

| Parameters ||
|---|---|
| `wasCompleted` | `Consumer`: The `https://developer.android.com/reference/java/util/function/Consumer` to be completed. If the client can set the call active on their end, the `https://developer.android.com/reference/java/util/function/Consumer#accept(T)` should be called with `https://developer.android.com/reference/java/lang/Boolean#TRUE`. Otherwise, `https://developer.android.com/reference/java/util/function/Consumer#accept(T)` should be called with `https://developer.android.com/reference/java/lang/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`. <br /> |

### onSetInactive

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

<br />

| Parameters ||
|---|---|
| `wasCompleted` | `Consumer`: The `https://developer.android.com/reference/java/util/function/Consumer` to be completed. If the client can set the call inactive on their end, the `https://developer.android.com/reference/java/util/function/Consumer#accept(T)` should be called with `https://developer.android.com/reference/java/lang/Boolean#TRUE`. Otherwise, `https://developer.android.com/reference/java/util/function/Consumer#accept(T)` should be called with `https://developer.android.com/reference/java/lang/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`. <br /> |