解决措施调用bluetoothManager.startBluetoothDiscovery()接口,使用蓝牙扫描功能,在扫描结果中即可获取蓝牙mac地址。示例代码import { connection } from '@kit.ConnectivityKit'; import { BusinessError } from '@kit.BasicServicesKit'; function onReceiveEvent(data: Array<string>) { // data为蓝牙设备地址集合 console.info('bluetooth device find = '+ JSON.stringify(data)); } try { connection.on('bluetoothDeviceFind', onReceiveEvent); connection.startBluetoothDiscovery(); } catch (err) { console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); }参考链接发现蓝牙设备
解决措施
调用bluetoothManager.startBluetoothDiscovery()接口,使用蓝牙扫描功能,在扫描结果中即可获取蓝牙mac地址。
示例代码
参考链接
发现蓝牙设备