更新时间:2022-05-16 07:56:21
在BluetoothConnector.java的构造函数中,传入了一个uuidCandidates列表.
In the constructor of BluetoothConnector.java, a list of uuidCandidates is passed.
public BluetoothConnector(BluetoothDevice device, boolean secure, BluetoothAdapter adapter,
List<UUID> uuidCandidates)
{
this.device = device;
this.secure = secure;
this.adapter = adapter;
this.uuidCandidates = uuidCandidates;
if (this.uuidCandidates == null || this.uuidCandidates.isEmpty()) {
this.uuidCandidates = new ArrayList<UUID>();
this.uuidCandidates.add(UUID.fromString("fa87c0d0-afac-11de-8a39-0800200c9a66"));
}
}
你把它传给空了吗?
如果是,则尝试为您要连接的蓝牙设备调用 device.fetchUuidsWithSdp()
并在接收器中接收 BluetoothDevice.ACTION_UUID
意图.因为这将获取设备支持的 uuid 列表.
If yes,then try calling device.fetchUuidsWithSdp()
for the Bluetooth device you want to connect and receive BluetoothDevice.ACTION_UUID
intent in your receiver.As this will fetch a list of uuids supported for the device.