# CallExtensionScope

Artifact: [androidx.core:core-telecom](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/telecom/extensions/CallExtensionScope.kt+class:androidx.core.telecom.extensions.CallExtensionScope) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

*** ** * ** ***


```
public interface CallExtensionScope
```

<br />

*** ** * ** ***

Provides a scope where extensions can be first initialized and next managed for a `https://developer.android.com/reference/android/telecom/Call.html` once `https://developer.android.com/reference/androidx/core/telecom/extensions/CallExtensionScope#onConnected(kotlin.coroutines.SuspendFunction1)` is called.

The following extension is supported on a call:

- `https://developer.android.com/reference/androidx/core/telecom/extensions/CallExtensionScope#addParticipantExtension(kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction1)` - Show the user more information about the `https://developer.android.com/reference/androidx/core/telecom/extensions/Participant`s in the call.

```
class InCallServiceImpl : InCallServiceCompat() {
...
  override fun onCallAdded(call: Call) {
    lifecycleScope.launch {
      connectExtensions(context, call) {
        // Initialize extensions
        onConnected { call ->
          // change call states & listen for extension updates/send extension actions
        }
      }
      // Once the call is destroyed, control flow will resume again
    }
  }
 ...
}
```

## Summary

| ### Public methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/CallIconExtensionRemote` | `@https://developer.android.com/reference/androidx/core/telecom/util/ExperimentalAppActions https://developer.android.com/reference/androidx/core/telecom/extensions/CallExtensionScope#addCallIconSupport(kotlin.coroutines.SuspendFunction1)( @https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onCallIconChanged )` Add support for call icon updates and provides a callback to receive those updates. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/LocalCallSilenceExtensionRemote` | `https://developer.android.com/reference/androidx/core/telecom/extensions/CallExtensionScope#addLocalCallSilenceExtension(kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction1)( @https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onIsLocallySilencedUpdated, @https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onCanUserUpdateSilence )` Add support for this remote surface to display information related to the local call silence state for this call. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/MeetingSummaryRemote` | `https://developer.android.com/reference/androidx/core/telecom/extensions/CallExtensionScope#addMeetingSummaryExtension(kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction1)( @https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<https://developer.android.com/reference/java/lang/CharSequence.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onCurrentSpeakerChanged, @https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onParticipantCountChanged )` Add support for this remote surface to display meeting summary information for this call. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/ParticipantExtensionRemote` | `https://developer.android.com/reference/androidx/core/telecom/extensions/CallExtensionScope#addParticipantExtension(kotlin.coroutines.SuspendFunction1,kotlin.coroutines.SuspendFunction1)( @https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<https://developer.android.com/reference/androidx/core/telecom/extensions/Participant, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onActiveParticipantChanged, @https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/Participant>, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onParticipantsUpdated )` Add support for this remote surface to display information related to the `https://developer.android.com/reference/androidx/core/telecom/extensions/Participant`s in this call. |
| `abstract void` | `https://developer.android.com/reference/androidx/core/telecom/extensions/CallExtensionScope#onConnected(kotlin.coroutines.SuspendFunction1)(@https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/telecom/Call.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block)` Called when the `https://developer.android.com/reference/android/telecom/Call.html` extensions have been successfully set up and are ready to be used. |

## Public methods

### addCallIconSupport

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
@ExperimentalAppActions
abstract @NonNull CallIconExtensionRemote addCallIconSupport(
    @NonNull SuspendFunction1<@NonNull Uri, Unit> onCallIconChanged
)
```

Add support for call icon updates and provides a callback to receive those updates. This remote surface should implement a `https://developer.android.com/reference/android/database/ContentObserver.html` to observe changes to the icon's content URI. This is necessary to ensure the displayed icon reflects any updates made by the application if the URI remains the same.

```
connectExtensions(call) {
    val callIconExtension = addCallIconSupport(
        // consume call icon state changes
    )
    onConnected {
        // At this point, support for call icon extension will be known
    }
}
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onCallIconChanged` | A suspend function that will be invoked with the `https://developer.android.com/reference/android/net/Uri.html` of the new call icon whenever it changes. This callback will only be called if the calling application supports the call icon extension (i.e., `isSupported` returns `true`). |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/CallIconExtensionRemote` | A `https://developer.android.com/reference/androidx/core/telecom/extensions/CallIconExtensionRemote` instance that allows the remote to check if the calling application supports the call icon extension. The remote *must* use this instance to check support before expecting icon updates. |

### addLocalCallSilenceExtension

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
abstract @NonNull LocalCallSilenceExtensionRemote addLocalCallSilenceExtension(
    @NonNull SuspendFunction1<@NonNull Boolean, Unit> onIsLocallySilencedUpdated,
    @NonNull SuspendFunction1<@NonNull Boolean, Unit> onCanUserUpdateSilence
)
```

Add support for this remote surface to display information related to the local call silence state for this call.

```
connectExtensions(call) {
    val localCallSilenceExtension = addLocalCallSilenceExtension(
        // consume local call silence state changes
    )
    onConnected {
        // At this point, support for the local call silence extension will be known
    }
}
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onIsLocallySilencedUpdated` | Called when the local call silence state has changed and the UI should be updated. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onCanUserUpdateSilence` | Called when the ability for the user to control the silence state has changed. If `false`, the UI should disable the mic control (e.g. grey out the button) because the user is restricted by a meeting moderator or hardware limitations. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/LocalCallSilenceExtensionRemote` | The interface that is used to interact with the local call silence extension methods. |

### addMeetingSummaryExtension

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
abstract @NonNull MeetingSummaryRemote addMeetingSummaryExtension(
    @NonNull SuspendFunction1<CharSequence, Unit> onCurrentSpeakerChanged,
    @NonNull SuspendFunction1<@NonNull Integer, Unit> onParticipantCountChanged
)
```

Add support for this remote surface to display meeting summary information for this call.

This function establishes a connection with a remote service that provides meeting summary information, such as the current speaker and the number of participants. The extension will provide updates via the provided callbacks:

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<https://developer.android.com/reference/java/lang/CharSequence.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onCurrentSpeakerChanged` | A suspend function that is called whenever the current speaker in the meeting changes. The function receives a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html` representing the new speaker's identifier (e.g., name or ID) or null if there is no current speaker. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onParticipantCountChanged` | A suspend function that is called whenever the number of participants in the meeting changes. It receives the new participant count as an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html`, which is always 0 or greater. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/MeetingSummaryRemote` | A `https://developer.android.com/reference/androidx/core/telecom/extensions/MeetingSummaryRemote` object with an `isSupported` property of this object will indicate whether the meeting summary extension is supported by the calling application. Example Usage: ``` connectExtensions(call) { val meetingSummaryRemote =  addMeetingSummaryExtension( onCurrentSpeakerChanged = { speaker -> // Update UI with the new speaker Log.d(TAG, "Current speaker: $speaker") }, onParticipantCountChanged = { count -> // Update UI with the new participant count Log.d(TAG, "Participant count: $count") } ) onConnected { if (meetingSummaryRemote.isSupported) { // The extension is ready to use } else { // Handle the case where the extension is not supported. } } } ``` |

### addParticipantExtension

```
abstract @NonNull ParticipantExtensionRemote addParticipantExtension(
    @NonNull SuspendFunction1<Participant, Unit> onActiveParticipantChanged,
    @NonNull SuspendFunction1<@NonNull Set<@NonNull Participant>, Unit> onParticipantsUpdated
)
```

Add support for this remote surface to display information related to the `https://developer.android.com/reference/androidx/core/telecom/extensions/Participant`s in this call.

```
connectExtensions(call) {
    val participantExtension = addParticipantExtension(
        // consume participant changed events
    )
    onConnected {
        // extensions have been negotiated and actions are ready to be used
    }
}
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<https://developer.android.com/reference/androidx/core/telecom/extensions/Participant, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onActiveParticipantChanged` | Called with the active `https://developer.android.com/reference/androidx/core/telecom/extensions/Participant` in the call has changed. If this method is called with a `null` `https://developer.android.com/reference/androidx/core/telecom/extensions/Participant`, there is no active `https://developer.android.com/reference/androidx/core/telecom/extensions/Participant`. The active `https://developer.android.com/reference/androidx/core/telecom/extensions/Participant` in the call is the `https://developer.android.com/reference/androidx/core/telecom/extensions/Participant` that should take focus and be either more prominent on the screen or otherwise featured as active in UI. For example, this could be the `https://developer.android.com/reference/androidx/core/telecom/extensions/Participant` that is actively talking or presenting. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/Participant>, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onParticipantsUpdated` | Called when the `https://developer.android.com/reference/androidx/core/telecom/extensions/Participant`s in the `https://developer.android.com/reference/android/telecom/Call.html` have changed and the UI should be updated. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/ParticipantExtensionRemote` | The interface that is used to set up additional actions for this extension. |

### onConnected

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
abstract void onConnected(@NonNull SuspendFunction1<@NonNull Call, Unit> block)
```

Called when the `https://developer.android.com/reference/android/telecom/Call.html` extensions have been successfully set up and are ready to be used.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/telecom/Call.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block` | Called when the `https://developer.android.com/reference/android/telecom/Call.html` and initialized extensions are ready to be used. |