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

Indicates that for the lifetime of this session, Meet should verify that the listening app has access to the latest RecordingInfo.

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

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.

Throws
java.lang.IllegalStateException java.lang.IllegalStateException

if neither withCoWatching nor withCoDoing were called

verifyRecordingInfo

abstract AddonSession.Builder verifyRecordingInfo()

Indicates that for the lifetime of this session, Meet should verify that the listening app has access to the latest RecordingInfo. If this is called for the session, and gets out of sync, Meet will forcibly end the add-on session. If Meet ends the add-on session onSessionEnded will be called with SESSION_ENDED_DUE_TO_RECORDING_STATE_SYNC_ISSUE.

This cannot be changed. This can only be set up on prior to starting a session, and is then checked for the lifetime of the session.

Be aware, when using this option, if unable to communicate with Meet (due to a breakpoint while debugging, saturated executors, or anything else) the connection will be severed.

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 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 java.lang.NullPointerException

if coWatchingHandler 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 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

Throws
java.lang.IllegalArgumentException java.lang.IllegalArgumentException

if the provided metadata exceeds MAX_INDIVIDUAL_PARTICIPANT_METADATA_SIZE_BYTES bytes

java.lang.NullPointerException java.lang.NullPointerException

if handler is null