BluetoothDeviceFilter.Builder


public static final class BluetoothDeviceFilter.Builder
extends Object

java.lang.Object
   ↳ android.companion.BluetoothDeviceFilter.Builder


A builder for BluetoothDeviceFilter

Summary

Public constructors

Builder()

Public methods

BluetoothDeviceFilter.Builder addServiceUuid(ParcelUuid serviceUuid, ParcelUuid serviceUuidMask)

Add filtering by certain bits of BluetoothDevice.getUuids() A device with any uuid matching the given bits is considered passing

BluetoothDeviceFilter build()
BluetoothDeviceFilter.Builder setAddress(String address)
BluetoothDeviceFilter.Builder setNamePattern(Pattern regex)

Inherited methods

Public constructors

Builder

public Builder ()

Public methods

addServiceUuid

Added in API level 26
public BluetoothDeviceFilter.Builder addServiceUuid (ParcelUuid serviceUuid, 
                ParcelUuid serviceUuidMask)

Add filtering by certain bits of BluetoothDevice.getUuids() A device with any uuid matching the given bits is considered passing

Parameters
serviceUuid ParcelUuid: the values for the bits to match This value may be null.

serviceUuidMask ParcelUuid: if provided, only those bits would have to match. This value may be null.

Returns
BluetoothDeviceFilter.Builder This value cannot be null.

build

public BluetoothDeviceFilter build ()

Returns
BluetoothDeviceFilter

setAddress

Added in API level 26
public BluetoothDeviceFilter.Builder setAddress (String address)

Parameters
address String: if set, only devices with MAC address exactly matching the given one will pass the filter This value may be null.

Returns
BluetoothDeviceFilter.Builder This value cannot be null.

setNamePattern

Added in API level 26
public BluetoothDeviceFilter.Builder setNamePattern (Pattern regex)

Parameters
regex Pattern: if set, only devices with name matching the given regular expression will be shown This value may be null.

Returns
BluetoothDeviceFilter.Builder