# ExtensionInitializationScope

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/ExtensionInitializationScope.kt+class:androidx.core.telecom.extensions.ExtensionInitializationScope) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

*** ** * ** ***


```
public interface ExtensionInitializationScope
```

<br />

*** ** * ** ***

The scope used to initialize extensions on a call as well as manage initialized extensions associated with the call once the call has been set up.

Extensions contain state and optional actions that are used to support additional features on a call, such as information about the participants in the call.

Supported Extensions:

- The ability to describe meeting participant information as well as actions on those participants using `https://developer.android.com/reference/androidx/core/telecom/extensions/ExtensionInitializationScope#addParticipantExtension(kotlin.collections.List,androidx.core.telecom.extensions.Participant)`

For example, to add participant support, the participant extension can be created during initialization and then used as part of `https://developer.android.com/reference/androidx/core/telecom/extensions/ExtensionInitializationScope#onCall(kotlin.coroutines.SuspendFunction1)` to update participant state and listen to action requests from remote surfaces:

```
scope.launch {
        mCallsManager.addCallWithExtensions(attributes,
            onAnswerLambda,
            onDisconnectLambda,
            onSetActiveLambda,
            onSetInactiveLambda) {
                // Initialize extensions ...
                // Example: add participants support & associated actions
                val participantExtension = addParticipantExtension(initialParticipants)
                val raiseHandState = participantExtension.addRaiseHandSupport(
                        initialRaisedHands) { onHandRaisedStateChanged ->
                    // handle raised hand state changed
                }
                participantExtension.addKickParticipantSupport {
                        participant ->
                    // handle kicking the requested participant
                }
                // Call has been set up, perform in-call actions
                onCall {
                    // Example: collect call state updates
                    callStateFlow.onEach { newState ->
                        // handle call state updates
                    }.launchIn(this)
                    // update participant extensions
                    participantsFlow.onEach { newParticipants ->
                        participantExtension.updateParticipants(newParticipants)
                    }.launchIn(this)
                    raisedHandsFlow.onEach { newRaisedHands ->
                        raiseHandState.updateRaisedHands(newRaisedHands)
                    }.launchIn(this)
                }
            }
        }
}
```

## Summary

| ### Public methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/CallIconExtension` | `@https://developer.android.com/reference/androidx/core/telecom/util/ExperimentalAppActions https://developer.android.com/reference/androidx/core/telecom/extensions/ExtensionInitializationScope#addCallIconExtension(android.net.Uri)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html initialCallIconUri)` Adds the call icon extension to a call, which allows the application to specify a custom icon to be displayed on remote surfaces (e.g., automotive displays, smartwatches) during an active call. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/LocalCallSilenceExtension` | `https://developer.android.com/reference/androidx/core/telecom/extensions/ExtensionInitializationScope#addLocalCallSilenceExtension(kotlin.Boolean,kotlin.Boolean,kotlin.coroutines.SuspendFunction1)( boolean initialCallSilenceState, boolean initialCanUserUpdateSilenceState, @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> onLocalSilenceUpdate )` Adds the local call silence extension to a call, which provides the ability for this application to signal to the local call silence state to other surfaces (e.g. Android Auto) |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/ParticipantExtension` | `https://developer.android.com/reference/androidx/core/telecom/extensions/ExtensionInitializationScope#addParticipantExtension(kotlin.collections.List,androidx.core.telecom.extensions.Participant)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/Participant> initialParticipants, https://developer.android.com/reference/androidx/core/telecom/extensions/Participant initialActiveParticipant )` Adds the participant extension to a call, which provides the ability for this application to specify participant related information, which will be shared with remote surfaces that support displaying that information (automotive, watch, etc...). |
| `abstract void` | `https://developer.android.com/reference/androidx/core/telecom/extensions/ExtensionInitializationScope#onCall(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/androidx/core/telecom/CallControlScope, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onCall)` User provided callback implementation that is run when the call is ready using the provided `https://developer.android.com/reference/androidx/core/telecom/CallControlScope`. |

## Public methods

### addCallIconExtension

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

```
@ExperimentalAppActions
abstract @NonNull CallIconExtension addCallIconExtension(@NonNull Uri initialCallIconUri)
```

Adds the call icon extension to a call, which allows the application to specify a custom icon to be displayed on remote surfaces (e.g., automotive displays, smartwatches) during an active call. This provides a way to visually represent the call with a specific app, service, or context.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html initialCallIconUri` | The initial `https://developer.android.com/reference/android/net/Uri.html` of the icon to be displayed. This URI should point to a valid image resource that can be loaded and displayed by remote surfaces. Consider using a Content Provider URI for accessing resources within your application. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/CallIconExtension` | The interface used by this application to further update the call icon extension state to remote surfaces. This allows dynamically changing the icon during the call. |

### addLocalCallSilenceExtension

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

```
abstract @NonNull LocalCallSilenceExtension addLocalCallSilenceExtension(
    boolean initialCallSilenceState,
    boolean initialCanUserUpdateSilenceState,
    @NonNull SuspendFunction1<@NonNull Boolean, Unit> onLocalSilenceUpdate
)
```

Adds the local call silence extension to a call, which provides the ability for this application to signal to the local call silence state to other surfaces (e.g. Android Auto)

Local Call Silence means that the call should be silenced at the application layer (local silence) instead of the hardware layer (global silence). Using a local call silence over global silence is advantageous when the application wants to still receive the audio input data while not transmitting audio input data to remote users.

| Parameters |
|---|---|
| `boolean initialCallSilenceState` | The initial call silence value at the start of the call. True, signals silence the user and do not transmit audio data to the remote users. False signals the mic is transmitting audio data at the application layer. |
| `boolean initialCanUserUpdateSilenceState` | The initial state determining if the user is allowed to toggle the silence state. Set this to 'false' if the user joins the call in a restricted state, such as being restricted by a moderator (e.g. a host hard-muting participants) , joining a live stream as a passive viewer, or using a hardware mode with no audio input. Defaults to 'true'. |
| `@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> onLocalSilenceUpdate` | This is called when the user has requested to change their silence state on a remote surface. If true, this user has requested to silence the microphone. If false, this user has unsilenced the microphone. This operation should not return until the request has been processed. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/LocalCallSilenceExtension` | The interface used by this application to further update the local call silence extension state to remote surfaces |

### addParticipantExtension

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

```
abstract @NonNull ParticipantExtension addParticipantExtension(
    @NonNull List<@NonNull Participant> initialParticipants,
    Participant initialActiveParticipant
)
```

Adds the participant extension to a call, which provides the ability for this application to specify participant related information, which will be shared with remote surfaces that support displaying that information (automotive, watch, etc...).

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/Participant> initialParticipants` | The initial `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` of `https://developer.android.com/reference/androidx/core/telecom/extensions/Participant`s in the call. Participants are displayed on the remote screen according to their order within the participants list, starting with the first element. Duplicate participants are removed. If the same participant is added to the list more than once, **only the first occurrence of that participant** will be retained in the list; subsequent duplicates are dropped. |
| `https://developer.android.com/reference/androidx/core/telecom/extensions/Participant initialActiveParticipant` | The initial `https://developer.android.com/reference/androidx/core/telecom/extensions/Participant` that is active in the call or `null` if there is no active participant. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/extensions/ParticipantExtension` | The interface used by this application to further update the participant extension state to remote surfaces |

### onCall

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

```
abstract void onCall(@NonNull SuspendFunction1<@NonNull CallControlScope, Unit> onCall)
```

User provided callback implementation that is run when the call is ready using the provided `https://developer.android.com/reference/androidx/core/telecom/CallControlScope`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull SuspendFunction1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/telecom/CallControlScope, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onCall` | callback invoked when the call has been notified to the framework and the call is ready |