CallExtensionScope


@ExperimentalAppActions
public interface CallExtensionScope


Provides a scope where extensions can be first initialized and next managed for a Call once onConnected is called.

The following extension is supported on a 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 @NonNull CallIconExtensionRemote
addCallIconSupport(
    @NonNull SuspendFunction1<@NonNull UriUnit> onCallIconChanged
)

Add support for call icon updates and provides a callback to receive those updates.

abstract @NonNull LocalCallSilenceExtensionRemote
addLocalCallSilenceExtension(
    @NonNull SuspendFunction1<@NonNull BooleanUnit> onIsLocallySilencedUpdated
)

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

abstract @NonNull MeetingSummaryRemote
addMeetingSummaryExtension(
    @NonNull SuspendFunction1<CharSequenceUnit> onCurrentSpeakerChanged,
    @NonNull SuspendFunction1<@NonNull IntegerUnit> onParticipantCountChanged
)

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

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

Add support for this remote surface to display information related to the Participants in this call.

abstract void
onConnected(@NonNull SuspendFunction1<@NonNull CallUnit> block)

Called when the Call extensions have been successfully set up and are ready to be used.

Public methods

addCallIconSupport

Added in 1.0.0-rc01
abstract @NonNull CallIconExtensionRemote addCallIconSupport(
    @NonNull SuspendFunction1<@NonNull UriUnit> onCallIconChanged
)

Add support for call icon updates and provides a callback to receive those updates. This remote surface should implement a android.database.ContentObserver 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
@NonNull SuspendFunction1<@NonNull UriUnit> onCallIconChanged

A suspend function that will be invoked with the Uri 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
@NonNull CallIconExtensionRemote

A 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.0.0-rc01
abstract @NonNull LocalCallSilenceExtensionRemote addLocalCallSilenceExtension(
    @NonNull SuspendFunction1<@NonNull BooleanUnit> onIsLocallySilencedUpdated
)

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
@NonNull SuspendFunction1<@NonNull BooleanUnit> onIsLocallySilencedUpdated

Called when the local call silence state has changed and the UI should be updated.

Returns
@NonNull LocalCallSilenceExtensionRemote

The interface that is used to interact with the local call silence extension methods.

addMeetingSummaryExtension

Added in 1.0.0-rc01
abstract @NonNull MeetingSummaryRemote addMeetingSummaryExtension(
    @NonNull SuspendFunction1<CharSequenceUnit> onCurrentSpeakerChanged,
    @NonNull SuspendFunction1<@NonNull IntegerUnit> 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
@NonNull SuspendFunction1<CharSequenceUnit> onCurrentSpeakerChanged

A suspend function that is called whenever the current speaker in the meeting changes. The function receives a CharSequence representing the new speaker's identifier (e.g., name or ID) or null if there is no current speaker.

@NonNull SuspendFunction1<@NonNull IntegerUnit> onParticipantCountChanged

A suspend function that is called whenever the number of participants in the meeting changes. It receives the new participant count as an Int, which is always 0 or greater.

Returns
@NonNull MeetingSummaryRemote

A 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<ParticipantUnit> onActiveParticipantChanged,
    @NonNull SuspendFunction1<@NonNull Set<@NonNull Participant>, Unit> onParticipantsUpdated
)

Add support for this remote surface to display information related to the Participants 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
@NonNull SuspendFunction1<ParticipantUnit> onActiveParticipantChanged

Called with the active Participant in the call has changed. If this method is called with a null Participant, there is no active Participant. The active Participant in the call is the 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 Participant that is actively talking or presenting.

@NonNull SuspendFunction1<@NonNull Set<@NonNull Participant>, Unit> onParticipantsUpdated

Called when the Participants in the Call have changed and the UI should be updated.

Returns
@NonNull ParticipantExtensionRemote

The interface that is used to set up additional actions for this extension.

onConnected

Added in 1.0.0-rc01
abstract void onConnected(@NonNull SuspendFunction1<@NonNull CallUnit> block)

Called when the Call extensions have been successfully set up and are ready to be used.

Parameters
@NonNull SuspendFunction1<@NonNull CallUnit> block

Called when the Call and initialized extensions are ready to be used.