1 回答

TA貢獻(xiàn)1951條經(jīng)驗(yàn) 獲得超3個(gè)贊
我找到了解決方案。
正如 ecle 所說,我查找或搜索藍(lán)牙單元的方法無法正常工作。
我改用這個(gè):
Set<BluetoothDevice> pairedDevices = mBluetoothAdapter
.getBondedDevices();
if (pairedDevices.isEmpty()) {
Log.e("bluetooth",
"No devices paired...");
return ;
}
String MY_MAC_ADDR = getResources().getString(R.string.Bluetooth_MAC);
for (BluetoothDevice device : pairedDevices) {
Log.d("Bluetooth", "Device : address : " + device.getAddress() + " name :"
+ device.getName());
if (MY_MAC_ADDR.equals(device.getAddress())) {
mmDevice = device;
break;
}
}
我現(xiàn)在正在尋找使用 MAC 地址的特定藍(lán)牙設(shè)備
現(xiàn)在它完美地工作了。謝謝ecle指出這一點(diǎn)。
添加回答
舉報(bào)