# OriginatingSessionStateCallback

# OriginatingSessionStateCallback

*** ** * ** ***

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

<br />

```
@RequiresApi(value = 26) interface OriginatingSessionStateCallback : SessionStateCallback
```

<br />

*** ** * ** ***

Clients of Sessions should implement`OriginatingSessionStateCallback`to receive notifications of Session state changes when transferring a Session.

Provide your implementation in[Sessions.transferSession](https://developer.android.com/reference/kotlin/com/google/ambient/crossdevice/sessions/Sessions#transferSession(com.google.ambient.crossdevice.sessions.SessionId,com.google.ambient.crossdevice.wakeup.StartComponentRequest,kotlin.collections.List,com.google.ambient.crossdevice.sessions.OriginatingSessionStateCallback)).

## Summary

|                                                                                                                                                                                                                                                                                                                    ### Public functions                                                                                                                                                                                                                                                                                                                     ||
|--------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://developer.android.com/reference/kotlin/kotlin/Unit) | [onConnected](https://developer.android.com/reference/kotlin/com/google/ambient/crossdevice/sessions/OriginatingSessionStateCallback#onConnected(com.google.ambient.crossdevice.sessions.SessionId))`(sessionId: `[SessionId](https://developer.android.com/reference/kotlin/com/google/ambient/crossdevice/sessions/SessionId)`)` Notifies the application that the`OriginatingSession`associated with`sessionId`is ready to begin communication with the receiving side.                                                                                                              |
| [Unit](https://developer.android.com/reference/kotlin/kotlin/Unit) | [onSessionTransferred](https://developer.android.com/reference/kotlin/com/google/ambient/crossdevice/sessions/OriginatingSessionStateCallback#onSessionTransferred(com.google.ambient.crossdevice.sessions.SessionId))`(sessionId: `[SessionId](https://developer.android.com/reference/kotlin/com/google/ambient/crossdevice/sessions/SessionId)`)` Called when a Session has been successfully transferred to another device (and no longer running on this device).                                                                                                                  |
| [Unit](https://developer.android.com/reference/kotlin/kotlin/Unit) | [onTransferFailure](https://developer.android.com/reference/kotlin/com/google/ambient/crossdevice/sessions/OriginatingSessionStateCallback#onTransferFailure(com.google.ambient.crossdevice.sessions.SessionId,com.google.ambient.crossdevice.sessions.SessionException))`(sessionId: `[SessionId](https://developer.android.com/reference/kotlin/com/google/ambient/crossdevice/sessions/SessionId)`, exception: `[SessionException](https://developer.android.com/reference/kotlin/com/google/ambient/crossdevice/sessions/SessionException)`)` Called when transfer cannot complete. |

## Public functions

### onConnected

```
fun onConnected(sessionId: SessionId): Unit
```

Notifies the application that the`OriginatingSession`associated with`sessionId`is ready to begin communication with the receiving side.  

### onSessionTransferred

```
fun onSessionTransferred(sessionId: SessionId): Unit
```

Called when a Session has been successfully transferred to another device (and no longer running on this device).  

### onTransferFailure

```
fun onTransferFailure(sessionId: SessionId, exception: SessionException): Unit
```

Called when transfer cannot complete. Failure reason described by`exception`.