AddonSession.Builder

@PublicApi
public interface AddonSession.Builder



A builder for AddonSession. See newSessionBuilder.

Summary

Public methods

abstract ListenableFuture<AddonSession>
begin(Context appContext)

Begins an add-on session.

abstract AddonSession.Builder
withCoDoing(CoDoingHandler coDoingHandler)

Adds co-doing to the add-on session.

abstract AddonSession.Builder
withCoWatching(CoWatchingHandler coWatchingHandler)

Adds co-watching to the add-on session.

abstract AddonSession.Builder
withCollaborationStartingState(
    CollaborationStartingState collaborationStartingState
)

Sets the CollaborationStartingState for the session.

abstract AddonSession.Builder

Registers a listener for updates to metadata for other participants.

abstract AddonSession.Builder
withParticipantMetadata(
    ParticipantMetadataHandler handler,
    byte[] metadata
)

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

Public methods

begin

abstract ListenableFuture<AddonSessionbegin(Context appContext)

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
Context appContext

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

abstract AddonSession.Builder withCoDoing(CoDoingHandler coDoingHandler)

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

abstract AddonSession.Builder withCoWatching(CoWatchingHandler coWatchingHandler)

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

abstract AddonSession.Builder withCollaborationStartingState(
    CollaborationStartingState collaborationStartingState
)

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

abstract AddonSession.Builder withParticipantMetadata(ParticipantMetadataHandler handler)

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
ParticipantMetadataHandler handler

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

Throws
java.lang.NullPointerException

if handler is null

withParticipantMetadata

abstract AddonSession.Builder withParticipantMetadata(
    ParticipantMetadataHandler handler,
    byte[] metadata
)

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
ParticipantMetadataHandler handler

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

byte[] metadata

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