Package io.cobrowse
Class Session
java.lang.Object
io.cobrowse.Session
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidTransitions a session from pending or authorizing to active, allowing frames to start streaming.agent()Gets the basic information about the support agent in the session, or null if no agent has joined yetcode()The six digit code that can be shared with an agent to allow them to join the screen share.voidEnds a session.Deprecated.Checks whether the session is allowed to capture screens from outside the app.booleanhasAgent()An agent has joined the sessionid()The ID of a session.booleanisActive()Tests if the session is in an active statebooleanTests if the session is in a authorizing state (waiting for user consent)booleanisEnded()Tests if the session is in an ended state (can no longer be used or updated)booleanTests if the session is in a pending state (waiting for an agent, or device)voidregisterSessionListener(Session.Listener listener) Adds a listener to be notified of changes in a sessionvoidremoveSessionListener(Session.Listener listener) Removes a session change listenervoidsetCapabilities(String[] capabilities, Callback<Error, Session> callback) Sets the available capabilities for the session.voidsetFullDevice(boolean state, Callback<Error, Session> callback) Deprecated.voidsetFullDeviceState(Session.FullDeviceState state, Callback<Error, Session> callback) Whether the app should try to capture screens from outside the app or not.voidsetRemoteControl(Session.RemoteControlState state, Callback<Error, Session> callback) state()The state of the session.void
-
Method Details
-
registerSessionListener
Adds a listener to be notified of changes in a session- Parameters:
listener- Your listener implementation
-
removeSessionListener
Removes a session change listener- Parameters:
listener- Your listener
-
code
The six digit code that can be shared with an agent to allow them to join the screen share. Note: this is only available for sessions in the "pending" state. Once an agent has joined the code will be null as it is no longer valid.- Returns:
- The six digit code
-
id
The ID of a session. You will likely never need to access this.- Returns:
- The Session ID
-
state
The state of the session. The session states transition as follows:pending ( → authorizing ) → active → ended
The states mean:
- pending - session has been created, but an agent or device has not yet joined
- authorizing - confirmation prompt shown, waiting for the user to accept the session
- active - the screen share session is in progress, frames are streaming
- ended - the session is finished and can no longer be used or updated
- Returns:
- The state (pending, authorizing, active, or ended)
- See Also:
-
update
-
agent
Gets the basic information about the support agent in the session, or null if no agent has joined yet- Returns:
- The agent information or null
-
setRemoteControl
public void setRemoteControl(Session.RemoteControlState state, @Nullable Callback<Error, Session> callback) -
remoteControl
-
hasAgent
public boolean hasAgent()An agent has joined the session- Returns:
- An agent has joined
-
isPending
public boolean isPending()Tests if the session is in a pending state (waiting for an agent, or device)- Returns:
- Pending state
-
isAuthorizing
public boolean isAuthorizing()Tests if the session is in a authorizing state (waiting for user consent)- Returns:
- Authorizing state
-
isActive
public boolean isActive()Tests if the session is in an active state- Returns:
- Pending state
-
isEnded
public boolean isEnded()Tests if the session is in an ended state (can no longer be used or updated)- Returns:
- Pending state
-
activate
Transitions a session from pending or authorizing to active, allowing frames to start streaming. In order to activate a session, some conditions must be met: 1. it must be in pending or authorizing state 2. an agent must have joined- Parameters:
callback- Called when the session is activated, or an error occurs
-
end
Ends a session. Once ended frames will stop streaming and it can no longer be used.- Parameters:
callback- Called when the end request completes, or there is an error.
-
fullDevice
Deprecated.Checks whether the session is allowed to capture screens from outside the app.- Returns:
- A value indicating whether the session is in full device state or not.
-
setFullDevice
Deprecated.Whether the app should try to capture screens from outside the app or not.- Parameters:
state- New full device state.callback- Called when the end request completes, or there is anError.
-
fullDeviceState
Checks whether the session is allowed to capture screens from outside the app.- Returns:
- Session full device state.
-
setFullDeviceState
public void setFullDeviceState(Session.FullDeviceState state, @Nullable Callback<Error, Session> callback) Whether the app should try to capture screens from outside the app or not.- Parameters:
state- New full device state.callback- Called when the end request completes, or there is anError.
-
setCapabilities
public void setCapabilities(@NonNull String[] capabilities, @Nullable Callback<Error, Session> callback) Sets the available capabilities for the session.- Parameters:
capabilities- Array of capability keys to enable.callback- A callback containing the updated session, or an error.
-