PrimarySessionStateCallback


@RequiresApi(value = 26) interface PrimarySessionStateCallback : SessionStateCallback


Clients of Sessions should implement PrimarySessionStateCallback to receive notifications of Session state changes when acting as the Primary for a Shared Session.

Provide your implementation in Sessions.shareSession.

Summary

Public functions

Unit
onParticipantDeparted(
    sessionId: SessionId,
    participant: SessionParticipant
)

Called when a secondary leaves the specified session.

Unit
onParticipantJoined(
    sessionId: SessionId,
    participant: SessionParticipant
)

Called when a secondary joins the specified session.

Unit

Called when a PrimarySession has no active secondaries (and no joins in progress).

Unit
onShareFailureWithParticipant(
    sessionId: SessionId,
    exception: SessionException,
    participant: SessionParticipant
)

Called when share cannot complete with a specific participant.

Unit
onShareInitiated(sessionId: SessionId, numPotentialParticipants: Int)

Called when a set of participants is provided with a Share request from this Primary.

Public functions

onParticipantDeparted

fun onParticipantDeparted(
    sessionId: SessionId,
    participant: SessionParticipant
): Unit

Called when a secondary leaves the specified session.

onParticipantJoined

fun onParticipantJoined(
    sessionId: SessionId,
    participant: SessionParticipant
): Unit

Called when a secondary joins the specified session.

onPrimarySessionCleanup

fun onPrimarySessionCleanup(sessionId: SessionId): Unit

Called when a PrimarySession has no active secondaries (and no joins in progress). After this call, continued use of the PrimarySession will return SessionException on all method calls because it is no longer valid.

onShareFailureWithParticipant

fun onShareFailureWithParticipant(
    sessionId: SessionId,
    exception: SessionException,
    participant: SessionParticipant
): Unit

Called when share cannot complete with a specific participant. Failure reason described by exception. Called on the originating device.

onShareInitiated

fun onShareInitiated(sessionId: SessionId, numPotentialParticipants: Int): Unit

Called when a set of participants is provided with a Share request from this Primary. This method will be called once for each application call to Sessions.shareSession.