public static final class AssociationRequest.Builder

  1. Object
  2. AssociationRequest.Builder
Assembles an AssociationRequest.

Constructors

public Builder()

Methods

public AssociationRequest.Builder profile(CompanionProfile profile)Sets the profile.
public AssociationRequest.Builder singleDevice(boolean singleDevice)Asks the platform to skip the chooser when exactly one device matches the filters.
public AssociationRequest.Builder addFilter(DeviceFilter filter)Adds a filter.
public AssociationRequest build()Builds the request.

Inherited methods

Constructor details

Builder

public Builder()

Method details

profile

public AssociationRequest.Builder profile(CompanionProfile profile)
Sets the profile. Defaults to CompanionProfile.GENERIC, which is what most accessories should ask for.

Parameters

profile CompanionProfile
the profile to request

Returns

this builder

singleDevice

public AssociationRequest.Builder singleDevice(boolean singleDevice)
Asks the platform to skip the chooser when exactly one device matches the filters. The user still consents – they are shown one device and confirm it – so this is a shortcut, not a way to associate silently.

Parameters

singleDevice boolean
whether to take the shortcut

Returns

this builder

addFilter

public AssociationRequest.Builder addFilter(DeviceFilter filter)
Adds a filter. Filters are OR-combined.

Parameters

filter DeviceFilter
the filter to add

Returns

this builder

build

public AssociationRequest build()
Builds the request.

Returns

the immutable request