# Session

## Nested classes <a href="#nested-classes" id="nested-classes"></a>

| Classes                                             |
| --------------------------------------------------- |
| SessionBuilder - Creates an instance of the Session |

## Fields <a href="#fields" id="fields"></a>

| Access and type                     | Field name                                                                                                               |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| *private final SessionListener*     | <ul><li><em><strong>mSessionListener</strong></em> - Interface for the Session's callbacks</li></ul>                     |
| *private SessionReconnectListener*  | <ul><li><em><strong>mSessionReconnectListener</strong></em> - Interface for the SessionReconnect's callbacks</li></ul>   |
| *private SessionConnectionListener* | <ul><li><em><strong>mSessionConnectionListener</strong></em> - Interface for the SessionConnection's callbacks</li></ul> |
| *private String*                    | <ul><li><em><strong>mUserName</strong></em> - The unique user's name for the session</li></ul>                           |
| *private AudioManager*              | <ul><li><strong>mAudioManager</strong> - Instance of AudioManager to work with audio routing</li></ul>                   |

## Public Constructor Summary <a href="#hardbreak-public-constructor-summary" id="hardbreak-public-constructor-summary"></a>

| Type           | Methods                                                        | Parameters                                                                                                        |
| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| SessionBuilder | Session(final SessionListener listener)                        | <ul><li><strong>listener</strong> - interface to session's callbacks;</li></ul>                                   |
| SessionBuilder | setReconnectListener(final SessionReconnectListener listener)  | <ul><li><strong>listener</strong> - interface to session’s reconnect callbacks;</li></ul>                         |
| SessionBuilder | setConnectionListener(final SessionConnectinListener listener) | <ul><li><strong>listener</strong> - interface to session's connection callbacks;</li></ul>                        |
| Session        | build(final Context context)                                   | <ul><li><strong>context</strong> - an interface to global information about an application environment;</li></ul> |

\
Public Method Summary <a href="#hardbreak-public-method-summary" id="hardbreak-public-method-summary"></a>
----------------------------------------------------------------------------------------------------------

| Type | Methods                                                                                                                                      | Parameters                                                                                                                                           |
| ---- | -------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| void | startCameraPreview() - creates local Media stream, which can be added on UI before Session ic connected.                                     |                                                                                                                                                      |
| void | <p>connect(String token )  -<br>This method will allow connecting to the Session</p>                                                         | <ul><li><strong>token</strong> - String value for authentication;</li></ul>                                                                          |
| void | <p>connect(String token, ParticipantType participantType)  -<br>This method will allow connecting to the Session with participant’s type</p> | <ul><li><strong>token</strong> - String value for authentication;</li><li><strong>participantType</strong> - participant’s connection type</li></ul> |
| void | <p>disconnect()<br>Disconnects from the Session</p>                                                                                          |                                                                                                                                                      |
| void | <p>switchCamera() - <br>The method switches camera capturer  for local stream from front camera to back</p>                                  |                                                                                                                                                      |
| void | sendMessage(String message) - The method sends messages to the Session all participants in the room                                          | <ul><li><strong>message</strong> - string messages</li></ul>                                                                                         |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.sceenic.co/watch-together-sdk/sscale-confluence-api-references/android-reference-new/session.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
