ReceivingSession


@RequiresApi(value = 26) interface ReceivingSession extends 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 methods

abstract @NonNull SessionId

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

abstract @NonNull ListenableFuture<@NonNull SessionId>

Java-compatible version of onComplete.

Inherited methods

From class com.google.ambient.crossdevice.sessions.TransferrableSession
abstract void

Cancels the transfer.

abstract @NonNull ListenableFuture<Unit>

Java-compatible version of cancelTransfer.

abstract @NonNull SessionRemoteConnection

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

Public methods

onComplete

abstract @NonNull SessionId onComplete()

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
@NonNull 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

abstract @NonNull ListenableFuture<@NonNull SessionIdonCompleteFuture()

Java-compatible version of onComplete.