ReceivingSession


@RequiresApi(value = 26) interface ReceivingSession : TransferrableSession


Describes a Session that is in the process of being transferred to another device. The receiver of the Session will use this class to initialize the application.

Summary

Public functions

suspend SessionId

Called when the receiving device is initialized and ready to run the Session.

ListenableFuture<SessionId>

Java-compatible version of onComplete.

Inherited functions

From class com.google.ambient.crossdevice.sessions.TransferrableSession
suspend Unit

Cancels the transfer.

ListenableFuture<Unit>

Java-compatible version of cancelTransfer.

SessionRemoteConnection

Gets communication channel to send initialization messages back and forth between the originating and receiving device.

Public functions

onComplete

suspend fun onComplete(): SessionId

Called when the receiving device is initialized and ready to run the Session. After this call, all methods will throw SessionException with HANDLE_INVALIDATED.

Returns
SessionId

The SessionId that was received.

Throws
com.google.ambient.crossdevice.sessions.SessionException: com.google.ambient.crossdevice.sessions.SessionException

if the transfer cannot be completed for any reason:

  • Session transfer is cancelled already (by either originating or receiving device)

  • Handle is invalidated

  • Internal error

onCompleteFuture

fun onCompleteFuture(): ListenableFuture<SessionId>

Java-compatible version of onComplete.