# TransferrableSession

# TransferrableSession

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/com/google/ambient/crossdevice/sessions/TransferrableSession "View this page in Kotlin")\|Java

<br />

```
@RequiresApi(value = 26) interface TransferrableSession
```

<br />

Known direct subclasses  
[OriginatingSession](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/OriginatingSession),[ReceivingSession](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/ReceivingSession)  

|--------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|
| [OriginatingSession](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/OriginatingSession) | Describes a Session that is in the process of being transferred to another device. |
| [ReceivingSession](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/ReceivingSession)     | Describes a Session that is in the process of being transferred to another device. |

*** ** * ** ***

Describes methods that are common to both originating and receiving sides of a Session transfer.

## Summary

|                                                                                                                                                                                                                                                                                  ### Public fields                                                                                                                                                                                                                                                                                   ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `abstract @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[SessionId](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionId) | [sessionId](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/TransferrableSession#sessionId()) [SessionId](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionId)this[TransferrableSession](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/TransferrableSession)belongs to. |

|                                                                                                                                                                                                                                                                                            ### Public methods                                                                                                                                                                                                                                                                                            ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `abstract void`                                                                                                                                                                                                                                                              | [cancelTransfer](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/TransferrableSession#cancelTransfer())`()` Cancels the transfer.                                                                                                                                                          |
| `abstract @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[ListenableFuture](https://developer.android.com/reference/com/google/common/util/concurrent/ListenableFuture)`<`[Unit](https://developer.android.com/reference/kotlin/Unit)`>` | [cancelTransferFuture](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/TransferrableSession#cancelTransferFuture())`()` Java-compatible version of[cancelTransfer](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/TransferrableSession#cancelTransfer()). |
| `abstract @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[SessionRemoteConnection](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionRemoteConnection)                                              | [getStartupRemoteConnection](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/TransferrableSession#getStartupRemoteConnection())`()` Gets communication channel to send initialization messages back and forth between the originating and receiving device.                                |

## Public fields

### sessionId

```
abstract @NonNull SessionId sessionId
```

[SessionId](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionId)this[TransferrableSession](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/TransferrableSession)belongs to.

## Public methods

### cancelTransfer

```
abstract void cancelTransfer()
```

Cancels the transfer. After this call, all methods will throw[SessionException](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionException)with[HANDLE_INVALIDATED](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionException.Companion#HANDLE_INVALIDATED()).  

|                                                                                                                                    Throws                                                                                                                                    ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|
| [com.google.ambient.crossdevice.sessions.SessionException](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionException)` com.google.ambient.crossdevice.sessions.SessionException` | if the transfer cannot be cancelled for any reason. |

### cancelTransferFuture

```
abstract @NonNull ListenableFuture<Unit> cancelTransferFuture()
```

Java-compatible version of[cancelTransfer](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/TransferrableSession#cancelTransfer()).  

### getStartupRemoteConnection

```
abstract @NonNull SessionRemoteConnection getStartupRemoteConnection()
```

Gets communication channel to send initialization messages back and forth between the originating and receiving device.  

|                                                                                                                                                                                        Returns                                                                                                                                                                                         ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[SessionRemoteConnection](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionRemoteConnection) | The[SessionRemoteConnection](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionRemoteConnection)relevant to the transfer. |

|                                                                                                                             Throws                                                                                                                              ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
| [com.google.ambient.crossdevice.sessions.SessionException](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionException)` com.google.ambient.crossdevice.sessions.SessionException` | if this session has already completed. |