AddonSession

@PublicApi
public interface AddonSession



An add-on session.

Contains methods common to all add-on sessions. For access to co-watching and co-doing, call getCoWatching and getCoDoing respectively.

Summary

Nested types

A builder for AddonSession.

Public methods

abstract ListenableFuture<Void>

Ends the add-on session and disconnects from the Meet app.

abstract void

Exits the state of suspended.

abstract CoDoingClient

Returns the CoDoingClient instance.

abstract CoWatchingClient

Returns the CoWatchingClient instance.

abstract AddonMeetingInfo

Returns information about the connected meeting, such as the meeting URL.

abstract boolean

Returns true if the session has ended.

abstract boolean

Indicates whether the session is suspended.

abstract void

Resets the starting state of the add-on.

abstract void

Suspends the add-on session.

abstract void

Updates the starting state of the add-on.

abstract void
updateParticipantMetadata(byte[] metadata)

Updates the metadata for this participant.

Public methods

endSession

abstract ListenableFuture<VoidendSession()

Ends the add-on session and disconnects from the Meet app. This does not force Meet to end the meeting nor does it cause the user to leave the meeting.

If the session has already ended, this is a no-op; it will not throw an exception.

Returns
ListenableFuture<Void>

a ListenableFuture which evaluates to success or a AddonException if there was an unexpected error

endSuspension

abstract void endSuspension()

Exits the state of suspended. The add-on app is once again able to send and receive updates.

If the this is not in a state of suspended, this is a no-op.

Throws
java.lang.IllegalStateException

if the session has ended. This could either be an explicit call to endSession or it could be due to an external reason which would be surfaced via onSessionEnded.

getCoDoing

abstract CoDoingClient getCoDoing()

Returns the CoDoingClient instance.

Throws
java.lang.IllegalStateException

if the session was built without calling withCoDoing or if the session has ended

getCoWatching

abstract CoWatchingClient getCoWatching()

Returns the CoWatchingClient instance.

Throws
java.lang.IllegalStateException

if the session was built without calling withCoWatching or if the session has ended

getMeetingInfo

abstract AddonMeetingInfo getMeetingInfo()

Returns information about the connected meeting, such as the meeting URL.

Throws
java.lang.IllegalStateException

if the session has ended. This could either be an explicit call to endSession or it could be due to an external reason which would be surfaced via onSessionEnded.

isSessionEnded

abstract boolean isSessionEnded()

Returns true if the session has ended. This could either be from an explicit call to endSession or it could be due to an external reason which would be surfaced via onSessionEnded.

Throws
java.lang.IllegalStateException

if the session has ended. This could either be an explicit call to endSession or it could be due to an external reason which would be surfaced via onSessionEnded

isSuspended

abstract boolean isSuspended()

Indicates whether the session is suspended. See suspend and endSuspension.

Throws
java.lang.IllegalStateException

if the session has ended. This could either be an explicit call to endSession or it could be due to an external reason which would be surfaced via onSessionEnded.

resetCollaborationStartingState

abstract void resetCollaborationStartingState()

Resets the starting state of the add-on. This will clear the starting state previously received by other participants. The starting state can only be reset by the initiator.

suspend

abstract void suspend()

Suspends the add-on session. This does NOT disconnect from the Meet app. This causes the SDK to avoid sending updates to your CoDoingHandler and CoWatchingHandler, and causes the SDK to ignore calls to notify calls and to ignore calls to update the global state.

If the session is already suspended, this is a no-op.

For example, you may choose to call suspend when a user, but not every user, has playback interrupted to view an ad, when a user backgrounds the application, etc.

Throws
java.lang.IllegalStateException

if the session has ended. This could either be an explicit call to endSession or it could be due to an external reason which would be surfaced via onSessionEnded.

updateCollaborationStartingState

abstract void updateCollaborationStartingState(
    CollaborationStartingState startingState
)

Updates the starting state of the add-on. This is received by other participants when they accept the invitation to collaborate. The starting state can only be updated by the initiator.

Parameters
CollaborationStartingState startingState

the starting state of add-on

updateParticipantMetadata

abstract void updateParticipantMetadata(byte[] metadata)

Updates the metadata for this participant.

To receive metadata from other participants, a handler must be registered by calling withParticipantMetadata while building the AddonSession.

The encoded metadata is capped at MAX_INDIVIDUAL_PARTICIPANT_METADATA_SIZE_BYTES bytes per participant.

Parameters
byte[] metadata

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

Throws
java.lang.IllegalArgumentException

if the provided metadata exceeds MAX_INDIVIDUAL_PARTICIPANT_METADATA_SIZE_BYTES bytes

java.lang.IllegalStateException

if the session has ended. This could either be an explicit call to endSession or it could be due to an external reason which would be surfaced via onSessionEnded.