MediaSession.ConnectionResult


public final class MediaSession.ConnectionResult


A result for onConnect to denote the set of available commands and the media button preferences for a controller.

Summary

Nested types

A builder for ConnectionResult instances to accept a connection.

Public fields

final Player.Commands

Available player commands.

final SessionCommands

Available session commands.

final @Nullable ImmutableList<CommandButton>

The custom layout or null if the custom layout of the session should be used.

final boolean

Whether the connection request is accepted or not.

final @Nullable ImmutableList<CommandButton>

The media button preferences or null if the media button preferences of the session should be used.

final @Nullable PendingIntent

The session activity.

final @Nullable Bundle

The session extras.

Public methods

static MediaSession.ConnectionResult
accept(
    SessionCommands availableSessionCommands,
    Player.Commands availablePlayerCommands
)

Creates a connection result with the given session and player commands.

static MediaSession.ConnectionResult

Creates a ConnectionResult to reject a connection.

Constants

DEFAULT_PLAYER_COMMANDS

@UnstableApi
public static final Player.Commands DEFAULT_PLAYER_COMMANDS

DEFAULT_SESSION_AND_LIBRARY_COMMANDS

@UnstableApi
public static final SessionCommands DEFAULT_SESSION_AND_LIBRARY_COMMANDS

DEFAULT_SESSION_COMMANDS

@UnstableApi
public static final SessionCommands DEFAULT_SESSION_COMMANDS

Public fields

availablePlayerCommands

public final Player.Commands availablePlayerCommands

Available player commands.

availableSessionCommands

public final SessionCommands availableSessionCommands

Available session commands.

customLayout

@UnstableApi
public final @Nullable ImmutableList<CommandButtoncustomLayout

The custom layout or null if the custom layout of the session should be used.

isAccepted

public final boolean isAccepted

Whether the connection request is accepted or not.

mediaButtonPreferences

@UnstableApi
public final @Nullable ImmutableList<CommandButtonmediaButtonPreferences

The media button preferences or null if the media button preferences of the session should be used.

sessionActivity

@UnstableApi
public final @Nullable PendingIntent sessionActivity

The session activity.

sessionExtras

@UnstableApi
public final @Nullable Bundle sessionExtras

The session extras.

Public methods

accept

public static MediaSession.ConnectionResult accept(
    SessionCommands availableSessionCommands,
    Player.Commands availablePlayerCommands
)

Creates a connection result with the given session and player commands.

Commands are specific to the controller receiving this connection result.

The controller receives the media button preferences of the session.

See AcceptedResultBuilder for a more flexible way to accept a connection.

reject

public static MediaSession.ConnectionResult reject()

Creates a ConnectionResult to reject a connection.