AddonSession.Builder

@PublicApi
interface AddonSession.Builder


A builder for AddonSession. See newSessionBuilder.

Summary

Public functions

ListenableFuture<AddonSession!>!
begin(appContext: Context!)

Begins an add-on session.

AddonSession.Builder!
withCoDoing(coDoingHandler: CoDoingHandler!)

Adds co-doing to the add-on session.

AddonSession.Builder!
withCoWatching(coWatchingHandler: CoWatchingHandler!)

Adds co-watching to the add-on session.

AddonSession.Builder!
withCollaborationStartingState(
    collaborationStartingState: CollaborationStartingState!
)

Sets the CollaborationStartingState for the session.

AddonSession.Builder!

Registers a listener for updates to metadata for other participants.

AddonSession.Builder!
withParticipantMetadata(
    handler: ParticipantMetadataHandler!,
    metadata: ByteArray!
)

Sets the metadata for this participant and registers a listener for updates to other participants.

Public functions

begin

fun begin(appContext: Context!): ListenableFuture<AddonSession!>!

Begins an add-on session. This should only be called once the user has confirmed they want to participate in an add-on session.

Connects to a meeting, either by creating a meeting or by connecting to an ongoing meeting. Notes:

  • If a meeting is created, the current user will be the only participant initially.
  • Meeting details can be accessed via getMeetingInfo on the returned session.
  • The returned URL is intended to be exposed to the user and manually shared with their intended add-on session group.
The co-watching and co-doing instances can be accessed via getCoWatching and getCoDoing respectively.

It is not recommended to call cancel on this future, but instead to permit it to run to completion.

Parameters
appContext: Context!

the getApplicationContext value of the application that is using the SDK

Returns
ListenableFuture<AddonSession!>!

a ListenableFuture which evaluates to a AddonSession instance of the appropriate type if an add-on session was successfully started. Otherwise, evaluates to an IllegalStateException if another AddonSession is still running (e.g. endSession was not called) or to a AddonException if there was an unexpected error.

withCoDoing

fun withCoDoing(coDoingHandler: CoDoingHandler!): AddonSession.Builder!

Adds co-doing to the add-on session.

Parameters
coDoingHandler: CoDoingHandler!

callbacks for co-doing

Returns
AddonSession.Builder!

another builder instance for chaining

Throws
java.lang.NullPointerException

if coDoingHandler is null

withCoWatching

fun withCoWatching(coWatchingHandler: CoWatchingHandler!): AddonSession.Builder!

Adds co-watching to the add-on session.

Parameters
coWatchingHandler: CoWatchingHandler!

callbacks for co-watching

Returns
AddonSession.Builder!

another builder instance for chaining

Throws
java.lang.NullPointerException

if coWatchingHandler is null

withCollaborationStartingState

fun withCollaborationStartingState(
    collaborationStartingState: CollaborationStartingState!
): AddonSession.Builder!

Sets the CollaborationStartingState for the session.

This can be changed later by calling updateCollaborationStartingState or resetCollaborationStartingState.

Parameters
collaborationStartingState: CollaborationStartingState!

CollaborationStartingState data

Throws
java.lang.NullPointerException

if collaborationStartingState is null

withParticipantMetadata

fun withParticipantMetadata(handler: ParticipantMetadataHandler!): AddonSession.Builder!

Registers a listener for updates to metadata for other participants.

The local participant's metadata will be set to an empty value initially, but can be set later by calling updateParticipantMetadata. To set the initial value, call withParticipantMetadata instead.

Parameters
handler: ParticipantMetadataHandler!

a ParticipantMetadataHandler to receive the latest set of participant metadata every time it is updated

Throws
java.lang.NullPointerException

if handler is null

withParticipantMetadata

fun withParticipantMetadata(
    handler: ParticipantMetadataHandler!,
    metadata: ByteArray!
): AddonSession.Builder!

Sets the metadata for this participant and registers a listener for updates to other participants.

This metadata can be changed later by calling updateParticipantMetadata.

The encoded metadata is capped at MAX_INDIVIDUAL_PARTICIPANT_METADATA_SIZE_BYTES bytes per participant.

Parameters
handler: ParticipantMetadataHandler!

a ParticipantMetadataHandler to receive the latest set of participant metadata every time it is updated

metadata: ByteArray!

an encoded blob of metadata that describes relevant metadata for the local participant