# SessionRemoteConnection

# SessionRemoteConnection

*** ** * ** ***

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

<br />

```
@RequiresApi(value = 26) interface SessionRemoteConnection
```

<br />

*** ** * ** ***

A connection to a remote device that is participating in a Session. This is a wrapper around[RemoteConnection](https://developer.android.com/reference/com/google/ambient/crossdevice/connections/RemoteConnection)updated to be specific to[SessionParticipant](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionParticipant).

## Summary

|                                                                                                                                                                                             ### Public fields                                                                                                                                                                                             ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `abstract @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[SessionParticipant](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionParticipant) | [participant](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionRemoteConnection#participant()) The participant this this is a connection to. |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                 ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                  ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `abstract void`                                                                                                                                                                                                                                                                 | [registerReceiver](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionRemoteConnection#registerReceiver(com.google.ambient.crossdevice.sessions.SessionConnectionReceiver))`(@`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[SessionConnectionReceiver](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionConnectionReceiver)` receiver)` Registers the given[SessionConnectionReceiver](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionConnectionReceiver)with this channel. |
| `abstract @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[Result](https://developer.android.com/reference/kotlin/Result)`<`[Unit](https://developer.android.com/reference/kotlin/Unit)`>`                                                   | [send](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionRemoteConnection#send(kotlin.ByteArray))`(@`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` byte[] bytes)` See[RemoteConnection.send](https://developer.android.com/reference/com/google/ambient/crossdevice/connections/RemoteConnection#send(kotlin.ByteArray))                                                                                                                                                                                                                                    |
| `abstract @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[ListenableFuture](https://developer.android.com/reference/com/google/common/util/concurrent/ListenableFuture)`<`[Void](https://developer.android.com/reference/java/lang/Void)`>` | [sendFuture](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionRemoteConnection#sendFuture(kotlin.ByteArray))`(@`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` byte[] bytes)` Java-compatible version of[send](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionRemoteConnection#send(kotlin.ByteArray)).                                                                                                                                                                                                             |
| `abstract void`                                                                                                                                                                                                                                                                 | [unregisterReceiver](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionRemoteConnection#unregisterReceiver(com.google.ambient.crossdevice.sessions.SessionConnectionReceiver))`(@`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[SessionConnectionReceiver](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionConnectionReceiver)` receiver)` Unregisters a given receiver from the remote device.                                                                                                                    |

## Public fields

### participant

```
abstract @NonNull SessionParticipant participant
```

The participant this this is a connection to.

## Public methods

### registerReceiver

```
abstract void registerReceiver(@NonNull SessionConnectionReceiver receiver)
```

Registers the given[SessionConnectionReceiver](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionConnectionReceiver)with this channel.  

|                                                                                                                                   Throws                                                                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------|
| [com.google.ambient.crossdevice.connections.ConnectionsException](https://developer.android.com/reference/com/google/ambient/crossdevice/connections/ConnectionsException)` com.google.ambient.crossdevice.connections.ConnectionsException` | if the connection is closed. |

### send

```
abstract @NonNull Result<Unit> send(@NonNull byte[] bytes)
```

See[RemoteConnection.send](https://developer.android.com/reference/com/google/ambient/crossdevice/connections/RemoteConnection#send(kotlin.ByteArray))  

### sendFuture

```
abstract @NonNull ListenableFuture<Void> sendFuture(@NonNull byte[] bytes)
```

Java-compatible version of[send](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionRemoteConnection#send(kotlin.ByteArray)).  

### unregisterReceiver

```
abstract void unregisterReceiver(@NonNull SessionConnectionReceiver receiver)
```

Unregisters a given receiver from the remote device.