ExtensionInitializationScope


@ExperimentalAppActions
public interface ExtensionInitializationScope


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 addParticipantExtension

For example, to add participant support, the participant extension can be created during initialization and then used as part of onCall 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 @NonNull LocalCallSilenceExtension
addLocalCallSilenceExtension(
    boolean initialCallSilenceState,
    @NonNull SuspendFunction1<@NonNull BooleanUnit> 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 @NonNull ParticipantExtension
addParticipantExtension(
    @NonNull Set<@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...).

abstract void
onCall(
    @ExtensionFunctionType @NonNull SuspendFunction1<@NonNull CallControlScopeUnit> onCall
)

User provided callback implementation that is run when the call is ready using the provided CallControlScope.

Public methods

addLocalCallSilenceExtension

Added in 1.0.0-beta01
abstract @NonNull LocalCallSilenceExtension addLocalCallSilenceExtension(
    boolean initialCallSilenceState,
    @NonNull SuspendFunction1<@NonNull BooleanUnit> 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.

@NonNull SuspendFunction1<@NonNull BooleanUnit> 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
@NonNull 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-beta01
abstract @NonNull ParticipantExtension addParticipantExtension(
    @NonNull Set<@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
@NonNull Set<@NonNull Participant> initialParticipants

The initial Set of Participants in the call

Participant initialActiveParticipant

The initial Participant that is active in the call or null if there is no active participant.

Returns
@NonNull ParticipantExtension

The interface used by this application to further update the participant extension state to remote surfaces

onCall

Added in 1.0.0-beta01
abstract void onCall(
    @ExtensionFunctionType @NonNull SuspendFunction1<@NonNull CallControlScopeUnit> onCall
)

User provided callback implementation that is run when the call is ready using the provided CallControlScope.

Parameters
@ExtensionFunctionType @NonNull SuspendFunction1<@NonNull CallControlScopeUnit> onCall

callback invoked when the call has been notified to the framework and the call is ready