Stay organized with collections
Save and categorize content based on your preferences.
OriginatingSessionStateCallback
@RequiresApi(value = 26) interface OriginatingSessionStateCallback : SessionStateCallback
Clients of Sessions should implement OriginatingSessionStateCallback
to receive notifications of Session state changes when transferring a Session.
Provide your implementation in Sessions.transferSession
.
Summary
Public functions |
Unit |
Notifies the application that the OriginatingSession associated with sessionId is ready to begin communication with the receiving side.
|
Unit |
Called when a Session has been successfully transferred to another device (and no longer running on this device).
|
Unit |
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).
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# OriginatingSessionStateCallback\n===============================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/com/google/ambient/crossdevice/sessions/OriginatingSessionStateCallback \"View this page in Java\")\n\n\n```\n@RequiresApi(value = 26) interface OriginatingSessionStateCallback : SessionStateCallback\n```\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nClients of Sessions should implement `OriginatingSessionStateCallback` to receive notifications of Session state changes when transferring a Session.\n\nProvide your implementation in [Sessions.transferSession](/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)).\n\nSummary\n-------\n\n| ### Public functions ||\n|---------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Unit](/reference/kotlin/kotlin/Unit) | [onConnected](/reference/kotlin/com/google/ambient/crossdevice/sessions/OriginatingSessionStateCallback#onConnected(com.google.ambient.crossdevice.sessions.SessionId))`(sessionId: `[SessionId](/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. |\n| [Unit](/reference/kotlin/kotlin/Unit) | [onSessionTransferred](/reference/kotlin/com/google/ambient/crossdevice/sessions/OriginatingSessionStateCallback#onSessionTransferred(com.google.ambient.crossdevice.sessions.SessionId))`(sessionId: `[SessionId](/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). |\n| [Unit](/reference/kotlin/kotlin/Unit) | [onTransferFailure](/reference/kotlin/com/google/ambient/crossdevice/sessions/OriginatingSessionStateCallback#onTransferFailure(com.google.ambient.crossdevice.sessions.SessionId,com.google.ambient.crossdevice.sessions.SessionException))`(sessionId: `[SessionId](/reference/kotlin/com/google/ambient/crossdevice/sessions/SessionId)`, exception: `[SessionException](/reference/kotlin/com/google/ambient/crossdevice/sessions/SessionException)`)` Called when transfer cannot complete. |\n\nPublic functions\n----------------\n\n### onConnected\n\n```\nfun onConnected(sessionId: SessionId): Unit\n```\n\nNotifies the application that the `OriginatingSession` associated with `sessionId` is ready to begin communication with the receiving side. \n\n### onSessionTransferred\n\n```\nfun onSessionTransferred(sessionId: SessionId): Unit\n```\n\nCalled when a Session has been successfully transferred to another device (and no longer running on this device). \n\n### onTransferFailure\n\n```\nfun onTransferFailure(sessionId: SessionId, exception: SessionException): Unit\n```\n\nCalled when transfer cannot complete. Failure reason described by `exception`."]]