Stay organized with collections
Save and categorize content based on your preferences.
SecondarySession
@RequiresApi(value = 26) interface SecondarySession
When a Session becomes shared with one or more devices, this interface represents a secondary device (a device that has joined an existing Session).
Summary
Public fields
Public methods
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,["# SecondarySession\n================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/com/google/ambient/crossdevice/sessions/SecondarySession \"View this page in Kotlin\") \\|Java\n\n\n```\n@RequiresApi(value = 26) interface SecondarySession\n```\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nWhen a Session becomes shared with one or more devices, this interface represents a secondary device (a device that has joined an existing Session).\n\nSummary\n-------\n\n| ### Public fields ||\n|-------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `abstract @`[NonNull](/reference/androidx/annotation/NonNull)` `[SessionId](/reference/com/google/ambient/crossdevice/sessions/SessionId) | [sessionId](/reference/com/google/ambient/crossdevice/sessions/SecondarySession#sessionId()) [SessionId](/reference/com/google/ambient/crossdevice/sessions/SessionId) this [SecondarySession](/reference/com/google/ambient/crossdevice/sessions/SecondarySession) belongs to. |\n\n| ### Public methods ||\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `abstract void` | [destroySecondarySession](/reference/com/google/ambient/crossdevice/sessions/SecondarySession#destroySecondarySession())`()` Destroys the [SecondarySession](/reference/com/google/ambient/crossdevice/sessions/SecondarySession). |\n| `abstract @`[NonNull](/reference/androidx/annotation/NonNull)` `[ListenableFuture](/reference/com/google/common/util/concurrent/ListenableFuture)`\u003c`[Void](/reference/java/lang/Void)`\u003e` | [destroySecondarySessionFuture](/reference/com/google/ambient/crossdevice/sessions/SecondarySession#destroySecondarySessionFuture())`()` Java-compatible version of [destroySecondarySession](/reference/com/google/ambient/crossdevice/sessions/SecondarySession#destroySecondarySession()). |\n| `abstract @`[NonNull](/reference/androidx/annotation/NonNull)` `[SessionRemoteConnection](/reference/com/google/ambient/crossdevice/sessions/SessionRemoteConnection) | [getDefaultRemoteConnection](/reference/com/google/ambient/crossdevice/sessions/SecondarySession#getDefaultRemoteConnection())`()` Gets communication channel to send messages to the primary of the Sessions. |\n\nPublic fields\n-------------\n\n### sessionId\n\n```\nabstract @NonNull SessionId sessionId\n```\n\n[SessionId](/reference/com/google/ambient/crossdevice/sessions/SessionId) this [SecondarySession](/reference/com/google/ambient/crossdevice/sessions/SecondarySession) belongs to.\n\nPublic methods\n--------------\n\n### destroySecondarySession\n\n```\nabstract void destroySecondarySession()\n```\n\nDestroys the [SecondarySession](/reference/com/google/ambient/crossdevice/sessions/SecondarySession).\n\nWhen a [SecondarySession](/reference/com/google/ambient/crossdevice/sessions/SecondarySession) is destroyed, the connection with the Primary is terminated and this participant will leave the underlying Session. \n\n| Throws ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|\n| [com.google.ambient.crossdevice.sessions.SessionException](/reference/com/google/ambient/crossdevice/sessions/SessionException)` com.google.ambient.crossdevice.sessions.SessionException` | if the [SecondarySession](/reference/com/google/ambient/crossdevice/sessions/SecondarySession) object is no long valid. |\n\n### destroySecondarySessionFuture\n\n```\nabstract @NonNull ListenableFuture\u003cVoid\u003e destroySecondarySessionFuture()\n```\n\nJava-compatible version of [destroySecondarySession](/reference/com/google/ambient/crossdevice/sessions/SecondarySession#destroySecondarySession()). \n\n### getDefaultRemoteConnection\n\n```\nabstract @NonNull SessionRemoteConnection getDefaultRemoteConnection()\n```\n\nGets communication channel to send messages to the primary of the Sessions. \n\n| Throws ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|\n| [com.google.ambient.crossdevice.sessions.SessionException](/reference/com/google/ambient/crossdevice/sessions/SessionException)` com.google.ambient.crossdevice.sessions.SessionException` | if the [SecondarySession](/reference/com/google/ambient/crossdevice/sessions/SecondarySession) object is no long valid. |"]]