MatchmakingRequest.Builder


public static final class MatchmakingRequest.Builder
extends Object

java.lang.Object
   ↳ android.health.connect.MatchmakingRequest.Builder


Builder class for MatchmakingRequest.

By default, the builder initializes with an empty set of record types, include and exclude data sources.

Summary

Public constructors

Builder()

Public methods

MatchmakingRequest.Builder addRecordType(Class<? extends Record> recordType)

Adds a record type to the request.

MatchmakingRequest.Builder addRecordTypes(Set<Class<? extends Record>> recordTypes)

Adds a list of record types to the request.

MatchmakingRequest build()

Builds the MatchmakingRequest instance.

MatchmakingRequest.Builder setExcludedDataSources(Set<DataOrigin> dataOrigins)

Sets the DataOrigins to be excluded from matchmaking.

MatchmakingRequest.Builder setIncludedDataSources(Set<DataOrigin> dataOrigins)

Sets the DataOrigins to be considered by matchmaking.

Inherited methods

Public constructors

Builder

Added in API level 37
Also in U Extensions 21
public Builder ()

Public methods

addRecordType

Added in API level 37
Also in U Extensions 21
public MatchmakingRequest.Builder addRecordType (Class<? extends Record> recordType)

Adds a record type to the request.

Parameters
recordType Class: The record type to add.
This value cannot be null.

Returns
MatchmakingRequest.Builder This builder.
This value cannot be null.

addRecordTypes

Added in API level 37
Also in U Extensions 21
public MatchmakingRequest.Builder addRecordTypes (Set<Class<? extends Record>> recordTypes)

Adds a list of record types to the request.

Parameters
recordTypes Set: The list of record types to add.
This value cannot be null.

Returns
MatchmakingRequest.Builder This builder.
This value cannot be null.

build

Added in API level 37
Also in U Extensions 21
public MatchmakingRequest build ()

Builds the MatchmakingRequest instance.

By default, MatchmakingRequest.Builder().build() creates a request with an empty set of record types, included and excluded data sources. See description at HealthConnectManager.createMatchmakingIntent(MatchmakingRequest).

Returns
MatchmakingRequest A new instance of MatchmakingRequest.
This value cannot be null.

setExcludedDataSources

Added in API level 37
Also in U Extensions 22
public MatchmakingRequest.Builder setExcludedDataSources (Set<DataOrigin> dataOrigins)

Sets the DataOrigins to be excluded from matchmaking. Data sources in this set will not be considered. Providing an empty set means no specific data sources are excluded, effectively allowing all data sources to be considered (unless included by setIncludedDataSources(Set)).

By default, if neither setIncludedDataSources(Set) nor setExcludedDataSources(Set) are called, all available data sources will be considered.

Parameters
dataOrigins Set: The data origins to exclude. An empty set means no specific data sources are excluded.
This value cannot be null.

Returns
MatchmakingRequest.Builder This builder.
This value cannot be null.

Throws
IllegalStateException if setIncludedDataSources(Set) has been called with a non-empty set.

setIncludedDataSources

Added in API level 37
Also in U Extensions 22
public MatchmakingRequest.Builder setIncludedDataSources (Set<DataOrigin> dataOrigins)

Sets the DataOrigins to be considered by matchmaking. Only data sources in this set will be considered; data sources not in this set will be excluded. Providing an empty set means no specific data sources are included, effectively allowing all data sources to be considered (unless excluded by setExcludedDataSources(Set).

By default, if neither setIncludedDataSources(Set) nor setExcludedDataSources(Set) are called, all available data sources will be considered.

Parameters
dataOrigins Set: The data origins to include. An empty set means no specific data sources are included.
This value cannot be null.

Returns
MatchmakingRequest.Builder This builder.
This value cannot be null.

Throws
IllegalStateException if setExcludedDataSources(Set) has been called with a non-empty set.