AddonSession

@PublicApi
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 functions

ListenableFuture<Void!>!

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

Unit

Exits the state of suspended.

CoDoingClient!

Returns the CoDoingClient instance.

CoWatchingClient!

Returns the CoWatchingClient instance.

AddonMeetingInfo!

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

Boolean

Returns true if the session has ended.

Boolean

Indicates whether the session is suspended.

Unit

Resets the starting state of the add-on.

Unit

Suspends the add-on session.

Unit

Updates the starting state of the add-on.

Unit

Updates the metadata for this participant.

Public functions

endSession

fun endSession(): ListenableFuture<Void!>!

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

fun endSuspension(): Unit

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

fun getCoDoing(): CoDoingClient!

Returns the CoDoingClient instance.

Throws
java.lang.IllegalStateException

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

getCoWatching

fun getCoWatching(): CoWatchingClient!

Returns the CoWatchingClient instance.

Throws
java.lang.IllegalStateException

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

getMeetingInfo

fun getMeetingInfo(): AddonMeetingInfo!

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

fun isSessionEnded(): Boolean

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

fun isSuspended(): Boolean

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

fun resetCollaborationStartingState(): Unit

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

fun suspend(): Unit

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

fun updateCollaborationStartingState(
    startingState: CollaborationStartingState!
): Unit

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
startingState: CollaborationStartingState!

the starting state of add-on

updateParticipantMetadata

fun updateParticipantMetadata(metadata: ByteArray!): Unit

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
metadata: ByteArray!

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.