Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
    
    
  
  
    
    
  
  
BluetoothLeDeviceFilter.Builder
  public
  static
  final
  
  class
  BluetoothLeDeviceFilter.Builder
  
    extends Object
  
  
  
  
  
  
  
    
  Builder for BluetoothLeDeviceFilter
Summary
Public methods | 
  
  
  
    
        
        
        
        
        
        BluetoothLeDeviceFilter
     | 
  
    
      
      build()
      
      
     | 
  
  
  
  
  
    
        
        
        
        
        
        BluetoothLeDeviceFilter.Builder
     | 
  
    
      
      setNamePattern(Pattern regex)
      
      
     | 
  
  
  
  
  
    
        
        
        
        
        
        BluetoothLeDeviceFilter.Builder
     | 
  
    
      
      setRawDataFilter(byte[] rawDataFilter, byte[] rawDataFilterMask)
      
      
        Filter devices by raw advertisement data, as obtained by ScanRecord.getBytes
        
    
 
      
     | 
  
  
  
  
  
    
        
        
        
        
        
        BluetoothLeDeviceFilter.Builder
     | 
  
    
      
      setRenameFromBytes(String prefix, String suffix, int bytesFrom, int bytesLength, ByteOrder byteOrder)
      
      
        Rename the devices shown in the list, using specific bytes from the raw advertisement
 data (ScanRecord.getBytes) in hexadecimal format, as well as a custom
 prefix/suffix around them
 Note that the prefix length is limited to BluetoothLeDeviceFilter.getRenamePrefixLengthLimit() characters
 to ensure that there's enough space to display the byte data
 The range of bytes to be displayed cannot be empty
        
    
 
      
     | 
  
  
  
  
  
    
        
        
        
        
        
        BluetoothLeDeviceFilter.Builder
     | 
  
    
      
      setRenameFromName(String prefix, String suffix, int nameFrom, int nameLength)
      
      
        Rename the devices shown in the list, using specific characters from the advertised name,
 as well as a custom prefix/suffix around them
 Note that the prefix length is limited to BluetoothLeDeviceFilter.getRenamePrefixLengthLimit() characters
 to ensure that there's enough space to display the byte data
 The range of name characters to be displayed cannot be empty
        
    
 
      
     | 
  
  
  
  
  
    
        
        
        
        
        
        BluetoothLeDeviceFilter.Builder
     | 
  
    
      
      setScanFilter(ScanFilter scanFilter)
      
      
     | 
  
  
Inherited methods | 
  
    From class
      
        
          java.lang.Object
        
      
    
    
      
  
  
  
    
        
        
        
        
        
        Object
     | 
  
    
      
      clone()
      
      
        Creates and returns a copy of this object.
        
    
 
      
     | 
   
  
  
  
  
    
        
        
        
        
        
        boolean
     | 
  
    
      
      equals(Object obj)
      
      
        Indicates whether some other object is "equal to" this one.
        
    
 
      
     | 
   
  
  
  
  
    
        
        
        
        
        
        void
     | 
  
    
      
      finalize()
      
      
        Called by the garbage collector on an object when garbage collection
 determines that there are no more references to the object.
        
    
 
      
     | 
   
  
  
  
  
    
        
        
        
        final
        
        Class<?>
     | 
  
    
      
      getClass()
      
      
        Returns the runtime class of this Object.
        
    
 
      
     | 
   
  
  
  
  
    
        
        
        
        
        
        int
     | 
  
    
      
      hashCode()
      
      
        Returns a hash code value for the object.
        
    
 
      
     | 
   
  
  
  
  
    
        
        
        
        final
        
        void
     | 
  
    
      
      notify()
      
      
        Wakes up a single thread that is waiting on this object's
 monitor.
        
    
 
      
     | 
   
  
  
  
  
    
        
        
        
        final
        
        void
     | 
  
    
      
      notifyAll()
      
      
        Wakes up all threads that are waiting on this object's monitor.
        
    
 
      
     | 
   
  
  
  
  
    
        
        
        
        
        
        String
     | 
  
    
      
      toString()
      
      
        Returns a string representation of the object.
        
    
 
      
     | 
   
  
  
  
  
    
        
        
        
        final
        
        void
     | 
  
    
      
      wait(long timeoutMillis, int nanos)
      
      
        Causes the current thread to wait until it is awakened, typically
 by being notified or interrupted, or until a
 certain amount of real time has elapsed.
        
    
 
      
     | 
   
  
  
  
  
    
        
        
        
        final
        
        void
     | 
  
    
      
      wait(long timeoutMillis)
      
      
        Causes the current thread to wait until it is awakened, typically
 by being notified or interrupted, or until a
 certain amount of real time has elapsed.
        
    
 
      
     | 
   
  
  
  
  
    
        
        
        
        final
        
        void
     | 
  
    
      
      wait()
      
      
        Causes the current thread to wait until it is awakened, typically
 by being notified or interrupted.
        
    
 
      
     | 
   
  
     
   
 | 
Public constructors
    Builder
    
public Builder ()
    
    
    
  
 
Public methods
    setNamePattern
    
public BluetoothLeDeviceFilter.Builder setNamePattern (Pattern regex)
    
    
    
  
    
    | Parameters | 
      
        regex | 
        
          Pattern: if set, only devices with name matching the
              given regular expression will be shown
 This value may be null. | 
      
    
    
 
    setRawDataFilter
    
public BluetoothLeDeviceFilter.Builder setRawDataFilter (byte[] rawDataFilter, 
                byte[] rawDataFilterMask)
    
    
    
  Filter devices by raw advertisement data, as obtained by ScanRecord.getBytes
    
    | Parameters | 
      
        rawDataFilter | 
        
          byte: bit values that have to match against advertized data
 This value cannot be null. | 
      
      
        rawDataFilterMask | 
        
          byte: bits that have to be matched
 This value may be null. | 
      
    
    
 
    setRenameFromBytes
    
public BluetoothLeDeviceFilter.Builder setRenameFromBytes (String prefix, 
                String suffix, 
                int bytesFrom, 
                int bytesLength, 
                ByteOrder byteOrder)
    
    
    
  Rename the devices shown in the list, using specific bytes from the raw advertisement
 data (ScanRecord.getBytes) in hexadecimal format, as well as a custom
 prefix/suffix around them
 Note that the prefix length is limited to BluetoothLeDeviceFilter.getRenamePrefixLengthLimit() characters
 to ensure that there's enough space to display the byte data
 The range of bytes to be displayed cannot be empty
    
    | Parameters | 
      
        prefix | 
        
          String: to be displayed before the byte data
 This value cannot be null. | 
      
      
        suffix | 
        
          String: to be displayed after the byte data
 This value cannot be null. | 
      
      
        bytesFrom | 
        
          int: the start byte index to be displayed (inclusive) | 
      
      
        bytesLength | 
        
          int: the number of bytes to be displayed from the given index | 
      
      
        byteOrder | 
        
          ByteOrder: whether the given range of bytes is big endian (will be displayed
                   in same order) or little endian (will be flipped before displaying) | 
      
    
    
 
    setRenameFromName
    
public BluetoothLeDeviceFilter.Builder setRenameFromName (String prefix, 
                String suffix, 
                int nameFrom, 
                int nameLength)
    
    
    
  Rename the devices shown in the list, using specific characters from the advertised name,
 as well as a custom prefix/suffix around them
 Note that the prefix length is limited to BluetoothLeDeviceFilter.getRenamePrefixLengthLimit() characters
 to ensure that there's enough space to display the byte data
 The range of name characters to be displayed cannot be empty
    
    | Parameters | 
      
        prefix | 
        
          String: to be displayed before the byte data
 This value cannot be null. | 
      
      
        suffix | 
        
          String: to be displayed after the byte data
 This value cannot be null. | 
      
      
        nameFrom | 
        
          int: the start name character index to be displayed (inclusive) | 
      
      
        nameLength | 
        
          int: the number of characters to be displayed from the given index | 
      
    
    
 
 
 
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]