Java Android蓝牙通过蓝牙GATT获得响应
我是蓝牙新手。我使用代码 . 当我试图 获取信息-什么都没有发生Java Android蓝牙通过蓝牙GATT获得响应,java,android,bluetooth,Java,Android,Bluetooth,我是蓝牙新手。我使用代码 . 当我试图 获取信息-什么都没有发生 public String response() { if (mConnected) { mBluetoothLeService.readCharacteristic(characteristica); byte response[] = characteristica.getValue(); String respuesta = ReadBytes(response);
public String response() {
if (mConnected) {
mBluetoothLeService.readCharacteristic(characteristica);
byte response[] = characteristica.getValue();
String respuesta = ReadBytes(response);
mBluetoothLeService.disconnect();
return respuesta;
} else {
return null;
}
}
我在函数之后执行
private final ExpandableListView.OnChildClickListener servicesListClickListner
如何获取Bluetooth设备的信息?BLE操作是异步的,您必须在回调中处理结果。 在您的示例中: 检查onCharacteristicRead方法