Use this API to start discovering nearby Bluetooth devices. Use my.onBluetoothDeviceFound to receive discovered devices.
Parameters
Property
Type
Required
Description
services
Array
No
Filter by service UUIDs
allowDuplicatesKey
Boolean
No
Allow duplicate device reports (default: false)
interval
Number
No
Reporting frequency. Default: 0, meaning a device is reported as soon as it’s found; otherwise devices are reported at this interval
success
Function
No
Callback on success
fail
Function
No
Callback on failure
complete
Function
No
Callback that always executes
Code Example
Basic Usage
my.startBluetoothDevicesDiscovery({ success() { console.log('Started scanning for devices'); }});
Filter by Service UUID
my.startBluetoothDevicesDiscovery({ services: ['FEE7'], // Only discover devices with this service success() { console.log('Scanning for specific devices...'); }});