# TransportSessionApi

Use this API to subscribe to, and retrieve transport sessions. A transport session contains information about a completed transport, such as the transport mode and the raw sensor data used during it classification.

## TransportSessionApi API

### `enableTransportSessionRecording()`

> ```java
> void enableTransportSessionRecording()
> ```
>
> Enables transport session recording.
>
> This setting is persistent across app restarts, so you only need to enable session recording once. Note however that the setting is reset to 'disabled' after an SDK reset. See [reset](/important-topics/sdk/api-reference/android/sentiance.md#reset).
>
> Recorded sessions are stored on the device until the time that you request their deletion. See [`deleteTransportSession(String)`](#deletetransportsession).
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](/important-topics/sdk/api-reference/android/sdkexception.md).

### `disableTransportSessionRecording()`

> ```java
> void disableTransportSessionRecording()
> ```
>
> Disables transport session recording.
>
> This setting is persistent across app restarts, so you only need to disable session recording once.
>
> If you no longer need session recording, make sure to delete previously recorded sessions if you no longer need them. See [`deleteAllTransportSessions()`](#deletealltransportsessions).
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](/important-topics/sdk/api-reference/android/sdkexception.md).

### `getAvailableTransportSessions()`

> ```java
> List<TransportSession> getAvailableTransportSessions()
> ```
>
> Returns a list of recorded and completed transport sessions.
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](/important-topics/sdk/api-reference/android/sdkexception.md).

### `isTransportSessionRecordingEnabled()`

> ```java
> boolean isTransportSessionRecordingEnabled()
> ```
>
> Returns whether transport session recording is enabled.
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](/important-topics/sdk/api-reference/android/sdkexception.md).

### `setTransportSessionListener()`

> ```java
> void setTransportSessionListener(@Nullable TransportSessionListener listener)
> ```
>
> Sets a listener that will be invoked to deliver transport sessions. A session is delivered after a transport ends.
>
> Transport sessions are stored on the device until the time that you request their deletion. See [`deleteTransportSession(String)`](#deletetransportsession).
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](/important-topics/sdk/api-reference/android/sdkexception.md).

<table><thead><tr><th width="182">Parameters</th><th></th></tr></thead><tbody><tr><td>listener</td><td>A TransportSessionListener to receive transport sessions, or <code>null</code> to remove a previously set listener.</td></tr></tbody></table>

### `deleteAllTransportSessions()`

> ```java
> void deleteAllTransportSessions()
> ```
>
> Deletes all recorded transport sessions.
>
> Recorded sessions are stored on the device. It is your responsibility to call this method, or [`deleteTransportSession(String)`](#deletetransportsession), to request their deletion, when you no longer need them.
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](/important-topics/sdk/api-reference/android/sdkexception.md).

### `deleteTransportSession()`

> ```java
> void deleteTransportSession(String sessionId)
> ```
>
> Deletes the transport session with the specified ID.
>
> Recorded sessions are stored on the device. It is your responsibility to call this method, or [`deleteAllTransportSessions()`](#deletealltransportsessions), to request their deletion, when you no longer need them.
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](/important-topics/sdk/api-reference/android/sdkexception.md).

<table><thead><tr><th width="183">Parameters</th><th></th></tr></thead><tbody><tr><td>sessionId</td><td>The ID of the session to delete.</td></tr></tbody></table>


---

# 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://docs.sentiance.com/important-topics/sdk/api-reference/android/transport-sessions/transportsessionapi.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.
