# ScanFilter.Builder

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/bluetooth/le/ScanFilter.Builder "View this page in Java")  

```
class Builder
```

|---|------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                     ||
| ↳ | [android.bluetooth.le.ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#) |

Builder class for[ScanFilter](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter).

## Summary

|                                                    Public constructors                                                    ||
|------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#Builder())`()` <br /> |

|                                                                                                                                                                                                                                                                                                                                                             Public methods                                                                                                                                                                                                                                                                                                                                                             ||
|----------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ScanFilter](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter)!                  | [build](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#build())`()` Build[ScanFilter](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter).                                                                                                                                                                                                                                                                                                                                                                                                         |
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#)  | [setAdvertisingDataType](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#setAdvertisingDataType(kotlin.Int))`(`advertisingDataType:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set filter on advertising data with specific advertising data type.                                                                                                                                                                                                                                                                                         |
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#)  | [setAdvertisingDataTypeWithData](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#setAdvertisingDataTypeWithData(kotlin.Int,%20kotlin.ByteArray,%20kotlin.ByteArray))`(`advertisingDataType:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `advertisingData:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`, `advertisingDataMask:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`)` Set filter on advertising data with specific advertising data type. |
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#)! | [setDeviceAddress](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#setDeviceAddress(kotlin.String))`(`deviceAddress:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Set a scan filter on the remote device address.                                                                                                                                                                                                                                                                                                                     |
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#)! | [setDeviceName](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#setDeviceName(kotlin.String))`(`deviceName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Set filter on device name.                                                                                                                                                                                                                                                                                                                                                   |
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#)! | [setManufacturerData](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#setManufacturerData(kotlin.Int,%20kotlin.ByteArray))`(`manufacturerId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `manufacturerData:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!`)` Set filter on on manufacturerData.                                                                                                                                                                                                 |
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#)! | [setManufacturerData](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#setManufacturerData(kotlin.Int,%20kotlin.ByteArray,%20kotlin.ByteArray))`(`manufacturerId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `manufacturerData:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!`, `manufacturerDataMask:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!`)` Set filter on partial manufacture data.                                                    |
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#)! | [setServiceData](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#setServiceData(android.os.ParcelUuid,%20kotlin.ByteArray))`(`serviceDataUuid:` `[ParcelUuid](https://developer.android.com/reference/kotlin/android/os/ParcelUuid.html#)!`, `serviceData:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!`)` Set filtering on service data.                                                                                                                                                                                         |
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#)! | [setServiceData](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#setServiceData(android.os.ParcelUuid,%20kotlin.ByteArray,%20kotlin.ByteArray))`(`serviceDataUuid:` `[ParcelUuid](https://developer.android.com/reference/kotlin/android/os/ParcelUuid.html#)!`, `serviceData:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!`, `serviceDataMask:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!`)` Set partial filter on service data.                                                 |
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#)  | [setServiceSolicitationUuid](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#setServiceSolicitationUuid(android.os.ParcelUuid))`(`serviceSolicitationUuid:` `[ParcelUuid](https://developer.android.com/reference/kotlin/android/os/ParcelUuid.html#)?`)` Set filter on service solicitation uuid.                                                                                                                                                                                                                                                                              |
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#)  | [setServiceSolicitationUuid](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#setServiceSolicitationUuid(android.os.ParcelUuid,%20android.os.ParcelUuid))`(`serviceSolicitationUuid:` `[ParcelUuid](https://developer.android.com/reference/kotlin/android/os/ParcelUuid.html#)?`, `solicitationUuidMask:` `[ParcelUuid](https://developer.android.com/reference/kotlin/android/os/ParcelUuid.html#)?`)` Set filter on partial service Solicitation uuid.                                                                                                                        |
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#)! | [setServiceUuid](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#setServiceUuid(android.os.ParcelUuid))`(`serviceUuid:` `[ParcelUuid](https://developer.android.com/reference/kotlin/android/os/ParcelUuid.html#)!`)` Set filter on service uuid.                                                                                                                                                                                                                                                                                                                               |
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#)! | [setServiceUuid](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#setServiceUuid(android.os.ParcelUuid,%20android.os.ParcelUuid))`(`serviceUuid:` `[ParcelUuid](https://developer.android.com/reference/kotlin/android/os/ParcelUuid.html#)!`, `uuidMask:` `[ParcelUuid](https://developer.android.com/reference/kotlin/android/os/ParcelUuid.html#)!`)` Set filter on partial service uuid.                                                                                                                                                                                     |

## Public constructors

### Builder

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder()
```

## Public methods

### build

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun build(): ScanFilter!
```

Build[ScanFilter](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter).

|                              Exceptions                              ||
|--------------------------------------|--------------------------------|
| `java.lang.IllegalArgumentException` | If the filter cannot be built. |

### setAdvertisingDataType

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setAdvertisingDataType(advertisingDataType: Int): ScanFilter.Builder
```

Set filter on advertising data with specific advertising data type.

The values of`advertisingDataType`are assigned by Bluetooth SIG. For more details refer to Bluetooth Generic Access Profile. (https://www.bluetooth.com/specifications/assigned-numbers/)

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ||
|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `advertisingDataType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Value is[android.bluetooth.le.ScanRecord#DATA_TYPE_NONE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_NONE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_FLAGS](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_FLAGS:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_UUIDS_16_BIT_PARTIAL](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_UUIDS_16_BIT_PARTIAL:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_UUIDS_16_BIT_COMPLETE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_UUIDS_16_BIT_COMPLETE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_UUIDS_32_BIT_PARTIAL](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_UUIDS_32_BIT_PARTIAL:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_UUIDS_32_BIT_COMPLETE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_UUIDS_32_BIT_COMPLETE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_UUIDS_128_BIT_PARTIAL](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_UUIDS_128_BIT_PARTIAL:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_UUIDS_128_BIT_COMPLETE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_UUIDS_128_BIT_COMPLETE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_LOCAL_NAME_SHORT](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_LOCAL_NAME_SHORT:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_LOCAL_NAME_COMPLETE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_LOCAL_NAME_COMPLETE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_TX_POWER_LEVEL](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_TX_POWER_LEVEL:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_CLASS_OF_DEVICE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_CLASS_OF_DEVICE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SIMPLE_PAIRING_HASH_C](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SIMPLE_PAIRING_HASH_C:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SIMPLE_PAIRING_RANDOMIZER_R](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SIMPLE_PAIRING_RANDOMIZER_R:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_DEVICE_ID](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_DEVICE_ID:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SECURITY_MANAGER_OUT_OF_BAND_FLAGS](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SECURITY_MANAGER_OUT_OF_BAND_FLAGS:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SLAVE_CONNECTION_INTERVAL_RANGE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SLAVE_CONNECTION_INTERVAL_RANGE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_SOLICITATION_UUIDS_16_BIT](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_SOLICITATION_UUIDS_16_BIT:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_SOLICITATION_UUIDS_128_BIT](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_SOLICITATION_UUIDS_128_BIT:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_DATA_16_BIT](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_DATA_16_BIT:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_PUBLIC_TARGET_ADDRESS](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_PUBLIC_TARGET_ADDRESS:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_RANDOM_TARGET_ADDRESS](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_RANDOM_TARGET_ADDRESS:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_APPEARANCE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_APPEARANCE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_ADVERTISING_INTERVAL](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_ADVERTISING_INTERVAL:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_LE_ROLE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_LE_ROLE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SIMPLE_PAIRING_HASH_C_256](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SIMPLE_PAIRING_HASH_C_256:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SIMPLE_PAIRING_RANDOMIZER_R_256](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SIMPLE_PAIRING_RANDOMIZER_R_256:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_SOLICITATION_UUIDS_32_BIT](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_SOLICITATION_UUIDS_32_BIT:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_DATA_32_BIT](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_DATA_32_BIT:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_DATA_128_BIT](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_DATA_128_BIT:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_LE_SECURE_CONNECTIONS_RANDOM_VALUE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_LE_SECURE_CONNECTIONS_RANDOM_VALUE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_URI](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_URI:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_INDOOR_POSITIONING](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_INDOOR_POSITIONING:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_TRANSPORT_DISCOVERY_DATA](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_TRANSPORT_DISCOVERY_DATA:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_LE_SUPPORTED_FEATURES](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_LE_SUPPORTED_FEATURES:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_CHANNEL_MAP_UPDATE_INDICATION](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_CHANNEL_MAP_UPDATE_INDICATION:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_PB_ADV](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_PB_ADV:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_MESH_MESSAGE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_MESH_MESSAGE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_MESH_BEACON](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_MESH_BEACON:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_BIG_INFO](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_BIG_INFO:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_BROADCAST_CODE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_BROADCAST_CODE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_RESOLVABLE_SET_IDENTIFIER](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_RESOLVABLE_SET_IDENTIFIER:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_ADVERTISING_INTERVAL_LONG](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_ADVERTISING_INTERVAL_LONG:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_3D_INFORMATION_DATA](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_3D_INFORMATION_DATA:kotlin.Int), or[android.bluetooth.le.ScanRecord#DATA_TYPE_MANUFACTURER_SPECIFIC_DATA](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_MANUFACTURER_SPECIFIC_DATA:kotlin.Int) |

|                                                                   Return                                                                   ||
|---------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#) | This value cannot be`null`. |

|                                 Exceptions                                  ||
|--------------------------------------|---------------------------------------|
| `java.lang.IllegalArgumentException` | If the`advertisingDataType`is invalid |

### setAdvertisingDataTypeWithData

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setAdvertisingDataTypeWithData(
    advertisingDataType: Int, 
    advertisingData: ByteArray, 
    advertisingDataMask: ByteArray
): ScanFilter.Builder
```

Set filter on advertising data with specific advertising data type. For any bit in the mask, set it the 1 if it needs to match the one in advertising data, otherwise set it to 0.

The values of`advertisingDataType`are assigned by Bluetooth SIG. For more details refer to Bluetooth Generic Access Profile. (https://www.bluetooth.com/specifications/assigned-numbers/) The`advertisingDataMask`must have the same length of`advertisingData`.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ||
|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `advertisingDataType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Value is[android.bluetooth.le.ScanRecord#DATA_TYPE_NONE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_NONE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_FLAGS](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_FLAGS:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_UUIDS_16_BIT_PARTIAL](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_UUIDS_16_BIT_PARTIAL:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_UUIDS_16_BIT_COMPLETE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_UUIDS_16_BIT_COMPLETE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_UUIDS_32_BIT_PARTIAL](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_UUIDS_32_BIT_PARTIAL:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_UUIDS_32_BIT_COMPLETE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_UUIDS_32_BIT_COMPLETE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_UUIDS_128_BIT_PARTIAL](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_UUIDS_128_BIT_PARTIAL:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_UUIDS_128_BIT_COMPLETE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_UUIDS_128_BIT_COMPLETE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_LOCAL_NAME_SHORT](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_LOCAL_NAME_SHORT:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_LOCAL_NAME_COMPLETE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_LOCAL_NAME_COMPLETE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_TX_POWER_LEVEL](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_TX_POWER_LEVEL:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_CLASS_OF_DEVICE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_CLASS_OF_DEVICE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SIMPLE_PAIRING_HASH_C](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SIMPLE_PAIRING_HASH_C:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SIMPLE_PAIRING_RANDOMIZER_R](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SIMPLE_PAIRING_RANDOMIZER_R:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_DEVICE_ID](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_DEVICE_ID:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SECURITY_MANAGER_OUT_OF_BAND_FLAGS](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SECURITY_MANAGER_OUT_OF_BAND_FLAGS:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SLAVE_CONNECTION_INTERVAL_RANGE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SLAVE_CONNECTION_INTERVAL_RANGE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_SOLICITATION_UUIDS_16_BIT](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_SOLICITATION_UUIDS_16_BIT:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_SOLICITATION_UUIDS_128_BIT](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_SOLICITATION_UUIDS_128_BIT:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_DATA_16_BIT](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_DATA_16_BIT:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_PUBLIC_TARGET_ADDRESS](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_PUBLIC_TARGET_ADDRESS:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_RANDOM_TARGET_ADDRESS](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_RANDOM_TARGET_ADDRESS:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_APPEARANCE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_APPEARANCE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_ADVERTISING_INTERVAL](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_ADVERTISING_INTERVAL:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_LE_ROLE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_LE_ROLE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SIMPLE_PAIRING_HASH_C_256](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SIMPLE_PAIRING_HASH_C_256:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SIMPLE_PAIRING_RANDOMIZER_R_256](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SIMPLE_PAIRING_RANDOMIZER_R_256:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_SOLICITATION_UUIDS_32_BIT](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_SOLICITATION_UUIDS_32_BIT:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_DATA_32_BIT](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_DATA_32_BIT:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_SERVICE_DATA_128_BIT](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_SERVICE_DATA_128_BIT:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_LE_SECURE_CONNECTIONS_RANDOM_VALUE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_LE_SECURE_CONNECTIONS_RANDOM_VALUE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_URI](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_URI:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_INDOOR_POSITIONING](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_INDOOR_POSITIONING:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_TRANSPORT_DISCOVERY_DATA](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_TRANSPORT_DISCOVERY_DATA:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_LE_SUPPORTED_FEATURES](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_LE_SUPPORTED_FEATURES:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_CHANNEL_MAP_UPDATE_INDICATION](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_CHANNEL_MAP_UPDATE_INDICATION:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_PB_ADV](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_PB_ADV:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_MESH_MESSAGE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_MESH_MESSAGE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_MESH_BEACON](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_MESH_BEACON:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_BIG_INFO](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_BIG_INFO:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_BROADCAST_CODE](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_BROADCAST_CODE:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_RESOLVABLE_SET_IDENTIFIER](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_RESOLVABLE_SET_IDENTIFIER:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_ADVERTISING_INTERVAL_LONG](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_ADVERTISING_INTERVAL_LONG:kotlin.Int),[android.bluetooth.le.ScanRecord#DATA_TYPE_3D_INFORMATION_DATA](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_3D_INFORMATION_DATA:kotlin.Int), or[android.bluetooth.le.ScanRecord#DATA_TYPE_MANUFACTURER_SPECIFIC_DATA](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanRecord#DATA_TYPE_MANUFACTURER_SPECIFIC_DATA:kotlin.Int) |
| `advertisingData`     | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html):This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `advertisingDataMask` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html):This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

|                                                                   Return                                                                   ||
|---------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#) | This value cannot be`null`. |

|                                                                                          Exceptions                                                                                           ||
|--------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | If the`advertisingDataType`is invalid,`advertisingData`or`advertisingDataMask`is null or`advertisingData`and`advertisingDataMask`have different length. |

### setDeviceAddress

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setDeviceAddress(deviceAddress: String!): ScanFilter.Builder!
```

Set a scan filter on the remote device address.

The address passed to this API must be in big endian byte order. It needs to be in the format of "01:02:03:AB:CD:EF". The device address can be validated using[android.bluetooth.BluetoothAdapter#checkBluetoothAddress](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothAdapter.html#checkBluetoothAddress(kotlin.String)). The @AddressType is defaulted to[android.bluetooth.BluetoothDevice#ADDRESS_TYPE_PUBLIC](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothDevice.html#ADDRESS_TYPE_PUBLIC:kotlin.Int).

|                                                                      Parameters                                                                       ||
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------|
| `deviceAddress` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the remote device Bluetooth address for the filter |

|                              Exceptions                               ||
|--------------------------------------|---------------------------------|
| `java.lang.IllegalArgumentException` | if the`deviceAddress`is invalid |

### setDeviceName

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setDeviceName(deviceName: String!): ScanFilter.Builder!
```

Set filter on device name.  

### setManufacturerData

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setManufacturerData(
    manufacturerId: Int, 
    manufacturerData: ByteArray!
): ScanFilter.Builder!
```

Set filter on on manufacturerData. A negative manufacturerId is considered as invalid id.

|                               Exceptions                                ||
|--------------------------------------|-----------------------------------|
| `java.lang.IllegalArgumentException` | If the`manufacturerId`is invalid. |

### setManufacturerData

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setManufacturerData(
    manufacturerId: Int, 
    manufacturerData: ByteArray!, 
    manufacturerDataMask: ByteArray!
): ScanFilter.Builder!
```

Set filter on partial manufacture data. For any bit in the mask, set it the 1 if it needs to match the one in manufacturer data, otherwise set it to 0.

The`manufacturerDataMask`must have the same length of`manufacturerData`.

|                                                                                                 Exceptions                                                                                                 ||
|--------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | If the`manufacturerId`is invalid, or`manufacturerData`is null while`manufacturerDataMask`is not, or`manufacturerData`and`manufacturerDataMask`have different length. |

### setServiceData

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setServiceData(
    serviceDataUuid: ParcelUuid!, 
    serviceData: ByteArray!
): ScanFilter.Builder!
```

Set filtering on service data.

|                            Exceptions                             ||
|--------------------------------------|-----------------------------|
| `java.lang.IllegalArgumentException` | If`serviceDataUuid`is null. |

### setServiceData

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setServiceData(
    serviceDataUuid: ParcelUuid!, 
    serviceData: ByteArray!, 
    serviceDataMask: ByteArray!
): ScanFilter.Builder!
```

Set partial filter on service data. For any bit in the mask, set it to 1 if it needs to match the one in service data, otherwise set it to 0 to ignore that bit.

The`serviceDataMask`must have the same length of the`serviceData`.

|                                                                                  Exceptions                                                                                   ||
|--------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | If`serviceDataUuid`is null or`serviceDataMask`is`null`while`serviceData`is not or`serviceDataMask`and`serviceData`has different length. |

### setServiceSolicitationUuid

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setServiceSolicitationUuid(serviceSolicitationUuid: ParcelUuid?): ScanFilter.Builder
```

Set filter on service solicitation uuid.

|                                                                  Parameters                                                                   ||
|---------------------------|--------------------------------------------------------------------------------------------------------------------|
| `serviceSolicitationUuid` | [ParcelUuid](https://developer.android.com/reference/kotlin/android/os/ParcelUuid.html#)?:This value may be`null`. |

|                                                                   Return                                                                   ||
|---------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#) | This value cannot be`null`. |

### setServiceSolicitationUuid

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setServiceSolicitationUuid(
    serviceSolicitationUuid: ParcelUuid?, 
    solicitationUuidMask: ParcelUuid?
): ScanFilter.Builder
```

Set filter on partial service Solicitation uuid. The`SolicitationUuidMask`is the bit mask for the`serviceSolicitationUuid`. Set any bit in the mask to 1 to indicate a match is needed for the bit in`serviceSolicitationUuid`, and 0 to ignore that bit.

|                                                                               Parameters                                                                               ||
|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| `serviceSolicitationUuid` | [ParcelUuid](https://developer.android.com/reference/kotlin/android/os/ParcelUuid.html#)?:can only be null if solicitationUuidMask is null. |
| `solicitationUuidMask`    | [ParcelUuid](https://developer.android.com/reference/kotlin/android/os/ParcelUuid.html#)?:can be null or a mask with no restriction.        |

|                                                                   Return                                                                   ||
|---------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ScanFilter.Builder](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanFilter.Builder#) | This value cannot be`null`. |

|                                                   Exceptions                                                    ||
|--------------------------------------|---------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | If`serviceSolicitationUuid`is`null`but`solicitationUuidMask`is not`null`. |

### setServiceUuid

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setServiceUuid(serviceUuid: ParcelUuid!): ScanFilter.Builder!
```

Set filter on service uuid.  

### setServiceUuid

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setServiceUuid(
    serviceUuid: ParcelUuid!, 
    uuidMask: ParcelUuid!
): ScanFilter.Builder!
```

Set filter on partial service uuid. The`uuidMask`is the bit mask for the`serviceUuid`. Set any bit in the mask to 1 to indicate a match is needed for the bit in`serviceUuid`, and 0 to ignore that bit.

|                                       Exceptions                                        ||
|--------------------------------------|---------------------------------------------------|
| `java.lang.IllegalArgumentException` | If`serviceUuid`is`null`but`uuidMask`is not`null`. |