Stay organized with collections Save and categorize content based on your preferences.

PrimarySessionStateCallback

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

abstract void
onParticipantDeparted(
    @NonNull SessionId sessionId,
    @NonNull SessionParticipant participant
)

Called when a secondary leaves the specified session.

abstract void
onParticipantJoined(
    @NonNull SessionId sessionId,
    @NonNull SessionParticipant participant
)

Called when a secondary joins the specified session.

abstract void

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

abstract void
onShareFailureWithParticipant(
    @NonNull SessionId sessionId,
    @NonNull SessionException exception,
    @NonNull SessionParticipant participant
)

Called when share cannot complete with a specific participant.

abstract void
onShareInitiated(
    @NonNull SessionId sessionId,
    int numPotentialParticipants
)

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

Public methods

onParticipantDeparted

abstract void onParticipantDeparted(
    @NonNull SessionId sessionId,
    @NonNull SessionParticipant participant
)

Called when a secondary leaves the specified session.

onParticipantJoined

abstract void onParticipantJoined(
    @NonNull SessionId sessionId,
    @NonNull SessionParticipant participant
)

Called when a secondary joins the specified session.

onPrimarySessionCleanup

abstract void onPrimarySessionCleanup(@NonNull SessionId sessionId)

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

abstract void onShareFailureWithParticipant(
    @NonNull SessionId sessionId,
    @NonNull SessionException exception,
    @NonNull SessionParticipant participant
)

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

onShareInitiated

abstract void onShareInitiated(
    @NonNull SessionId sessionId,
    int numPotentialParticipants
)

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.