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 functions
Public properties
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\nKotlin \\|[Java](/reference/com/google/ambient/crossdevice/sessions/SecondarySession \"View this page in 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 functions ||\n|-----------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `suspend `[Unit](/reference/kotlin/kotlin/Unit) | [destroySecondarySession](/reference/kotlin/com/google/ambient/crossdevice/sessions/SecondarySession#destroySecondarySession())`()` Destroys the [SecondarySession](/reference/kotlin/com/google/ambient/crossdevice/sessions/SecondarySession). |\n| [ListenableFuture](/reference/kotlin/com/google/common/util/concurrent/ListenableFuture)`\u003c`[Void](/reference/kotlin/java/lang/Void)`?\u003e` | [destroySecondarySessionFuture](/reference/kotlin/com/google/ambient/crossdevice/sessions/SecondarySession#destroySecondarySessionFuture())`()` Java-compatible version of [destroySecondarySession](/reference/kotlin/com/google/ambient/crossdevice/sessions/SecondarySession#destroySecondarySession()). |\n| [SessionRemoteConnection](/reference/kotlin/com/google/ambient/crossdevice/sessions/SessionRemoteConnection) | [getDefaultRemoteConnection](/reference/kotlin/com/google/ambient/crossdevice/sessions/SecondarySession#getDefaultRemoteConnection())`()` Gets communication channel to send messages to the primary of the Sessions. |\n\n| ### Public properties ||\n|----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [SessionId](/reference/kotlin/com/google/ambient/crossdevice/sessions/SessionId) | [sessionId](/reference/kotlin/com/google/ambient/crossdevice/sessions/SecondarySession#sessionId()) [SessionId](/reference/kotlin/com/google/ambient/crossdevice/sessions/SessionId) this [SecondarySession](/reference/kotlin/com/google/ambient/crossdevice/sessions/SecondarySession) belongs to. |\n\nPublic functions\n----------------\n\n### destroySecondarySession\n\n```\nsuspend fun destroySecondarySession(): Unit\n```\n\nDestroys the [SecondarySession](/reference/kotlin/com/google/ambient/crossdevice/sessions/SecondarySession).\n\nWhen a [SecondarySession](/reference/kotlin/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: `[com.google.ambient.crossdevice.sessions.SessionException](/reference/kotlin/com/google/ambient/crossdevice/sessions/SessionException) | if the [SecondarySession](/reference/kotlin/com/google/ambient/crossdevice/sessions/SecondarySession) object is no long valid. |\n\n### destroySecondarySessionFuture\n\n```\nfun destroySecondarySessionFuture(): ListenableFuture\u003cVoid?\u003e\n```\n\nJava-compatible version of [destroySecondarySession](/reference/kotlin/com/google/ambient/crossdevice/sessions/SecondarySession#destroySecondarySession()). \n\n### getDefaultRemoteConnection\n\n```\nfun getDefaultRemoteConnection(): SessionRemoteConnection\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: `[com.google.ambient.crossdevice.sessions.SessionException](/reference/kotlin/com/google/ambient/crossdevice/sessions/SessionException) | if the [SecondarySession](/reference/kotlin/com/google/ambient/crossdevice/sessions/SecondarySession) object is no long valid. |\n\nPublic properties\n-----------------\n\n### sessionId\n\n```\nval sessionId: SessionId\n```\n\n[SessionId](/reference/kotlin/com/google/ambient/crossdevice/sessions/SessionId) this [SecondarySession](/reference/kotlin/com/google/ambient/crossdevice/sessions/SecondarySession) belongs to."]]