Stay organized with collections
Save and categorize content based on your preferences.
OriginatingSessionStateCallback
@RequiresApi(value = 26) interface OriginatingSessionStateCallback extends 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 methods |
abstract void |
Notifies the application that the OriginatingSession associated with sessionId is ready to begin communication with the receiving side.
|
abstract void |
Called when a Session has been successfully transferred to another device (and no longer running on this device).
|
abstract void |
Called when transfer cannot complete.
|
Public methods
onConnected
abstract void onConnected(@NonNull SessionId sessionId)
Notifies the application that the OriginatingSession
associated with sessionId
is ready to begin communication with the receiving side.
onSessionTransferred
abstract void onSessionTransferred(@NonNull SessionId sessionId)
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\n[Kotlin](/reference/kotlin/com/google/ambient/crossdevice/sessions/OriginatingSessionStateCallback \"View this page in Kotlin\") \\|Java\n\n\n```\n@RequiresApi(value = 26) interface OriginatingSessionStateCallback extends 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/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 methods ||\n|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `abstract void` | [onConnected](/reference/com/google/ambient/crossdevice/sessions/OriginatingSessionStateCallback#onConnected(com.google.ambient.crossdevice.sessions.SessionId))`(@`[NonNull](/reference/androidx/annotation/NonNull)` `[SessionId](/reference/com/google/ambient/crossdevice/sessions/SessionId)` sessionId)` Notifies the application that the `OriginatingSession` associated with `sessionId` is ready to begin communication with the receiving side. |\n| `abstract void` | [onSessionTransferred](/reference/com/google/ambient/crossdevice/sessions/OriginatingSessionStateCallback#onSessionTransferred(com.google.ambient.crossdevice.sessions.SessionId))`(@`[NonNull](/reference/androidx/annotation/NonNull)` `[SessionId](/reference/com/google/ambient/crossdevice/sessions/SessionId)` sessionId)` Called when a Session has been successfully transferred to another device (and no longer running on this device). |\n| `abstract void` | [onTransferFailure](/reference/com/google/ambient/crossdevice/sessions/OriginatingSessionStateCallback#onTransferFailure(com.google.ambient.crossdevice.sessions.SessionId,com.google.ambient.crossdevice.sessions.SessionException))`(` ` @`[NonNull](/reference/androidx/annotation/NonNull)` `[SessionId](/reference/com/google/ambient/crossdevice/sessions/SessionId)` sessionId,` ` @`[NonNull](/reference/androidx/annotation/NonNull)` `[SessionException](/reference/com/google/ambient/crossdevice/sessions/SessionException)` exception` `)` Called when transfer cannot complete. |\n\nPublic methods\n--------------\n\n### onConnected\n\n```\nabstract void onConnected(@NonNull SessionId sessionId)\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```\nabstract void onSessionTransferred(@NonNull SessionId sessionId)\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```\nabstract void onTransferFailure(\n @NonNull SessionId sessionId,\n @NonNull SessionException exception\n)\n```\n\nCalled when transfer cannot complete. Failure reason described by `exception`."]]