此问题可能由以下几个原因引起:
// Create a callback object and pass it in the readCharacteristic() method
mBluetoothGatt.readCharacteristic(characteristic);
private BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
@Override
public void onCharacteristicRead(BluetoothGatt gatt,
BluetoothGattCharacteristic characteristic,
int status) {
// Process the request response
}
};
// Disconnect from the device
mBluetoothGatt.disconnect();
// Reconnect to the device
mBluetoothGatt.connect();
// Read the characteristic
mBluetoothGatt.readCharacteristic(characteristic);