Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
A builder for BluetoothDeviceFilter
Summary
Public constructors
Public methods
setAddress
fun setAddress(address: String?): BluetoothDeviceFilter.Builder
Parameters |
address |
String?: if set, only devices with MAC address exactly matching the given one will pass the filter This value may be null . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# BluetoothDeviceFilter.Builder\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/companion/BluetoothDeviceFilter.Builder \"View this page in Java\") \n\n```\nclass Builder\n```\n\n|---|------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.companion.BluetoothDeviceFilter.Builder](#) |\n\nA builder for [BluetoothDeviceFilter](/reference/kotlin/android/companion/BluetoothDeviceFilter)\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------|---|\n| [Builder](#Builder())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [BluetoothDeviceFilter.Builder](#) | [addServiceUuid](#addServiceUuid(android.os.ParcelUuid,%20android.os.ParcelUuid))`(`serviceUuid:` `[ParcelUuid](../os/ParcelUuid.html#)?`, `serviceUuidMask:` `[ParcelUuid](../os/ParcelUuid.html#)?`)` Add filtering by certain bits of [BluetoothDevice.getUuids()](../bluetooth/BluetoothDevice.html#getUuids()) A device with any uuid matching the given bits is considered passing |\n| [BluetoothDeviceFilter](/reference/kotlin/android/companion/BluetoothDeviceFilter) | [build](#build())`()` \u003cbr /\u003e |\n| [BluetoothDeviceFilter.Builder](#) | [setAddress](#setAddress(kotlin.String))`(`address:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?`)` \u003cbr /\u003e |\n| [BluetoothDeviceFilter.Builder](#)! | [setNamePattern](#setNamePattern(java.util.regex.Pattern))`(`regex:` `[Pattern](../../java/util/regex/Pattern.html#)?`)` \u003cbr /\u003e |\n\nPublic constructors\n-------------------\n\n### Builder\n\n```\nBuilder()\n```\n\nPublic methods\n--------------\n\n### addServiceUuid\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun addServiceUuid(\n serviceUuid: ParcelUuid?, \n serviceUuidMask: ParcelUuid?\n): BluetoothDeviceFilter.Builder\n```\n\nAdd filtering by certain bits of [BluetoothDevice.getUuids()](../bluetooth/BluetoothDevice.html#getUuids()) A device with any uuid matching the given bits is considered passing\n\n| Parameters ||\n|-------------------|--------------------------------------------------------------------------------------------------------------------|\n| `serviceUuid` | [ParcelUuid](../os/ParcelUuid.html#)?: the values for the bits to match This value may be `null`. |\n| `serviceUuidMask` | [ParcelUuid](../os/ParcelUuid.html#)?: if provided, only those bits would have to match. This value may be `null`. |\n\n| Return ||\n|------------------------------------|------------------------------|\n| [BluetoothDeviceFilter.Builder](#) | This value cannot be `null`. |\n\n### build\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): BluetoothDeviceFilter\n```\n\n| Return ||\n|------------------------------------------------------------------------------------|------------------------------|\n| [BluetoothDeviceFilter](/reference/kotlin/android/companion/BluetoothDeviceFilter) | This value cannot be `null`. |\n\n### setAddress\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setAddress(address: String?): BluetoothDeviceFilter.Builder\n```\n\n| Parameters ||\n|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `address` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?: if set, only devices with MAC address exactly matching the given one will pass the filter This value may be `null`. |\n\n| Return ||\n|------------------------------------|------------------------------|\n| [BluetoothDeviceFilter.Builder](#) | This value cannot be `null`. |\n\n### setNamePattern\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setNamePattern(regex: Pattern?): BluetoothDeviceFilter.Builder!\n```\n\n| Parameters ||\n|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `regex` | [Pattern](../../java/util/regex/Pattern.html#)?: if set, only devices with [name](../bluetooth/BluetoothDevice.html#getName()) matching the given regular expression will be shown This value may be `null`. |"]]