Android-蓝牙写入事件
我做了一个蓝牙4.0LE应用程序 此应用程序将字节数据发送到BT设备 我做这个函数时做了测试,但一旦sendwrite设备断开连接 为什么断开 特别是LG智能手机 请帮帮我 ////////////// 公共静态无效发送_Databyte[]数据{Android-蓝牙写入事件,android,bluetooth,bluetooth-lowenergy,disconnect,Android,Bluetooth,Bluetooth Lowenergy,Disconnect,我做了一个蓝牙4.0LE应用程序 此应用程序将字节数据发送到BT设备 我做这个函数时做了测试,但一旦sendwrite设备断开连接 为什么断开 特别是LG智能手机 请帮帮我 ////////////// 公共静态无效发送_Databyte[]数据{ if (mByteCharacteristic != null ) { mByteCharacteristic.setValue(data); mByteCharacteristic setWriteType
if (mByteCharacteristic != null ) {
mByteCharacteristic.setValue(data);
mByteCharacteristic setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE);
if (bluetoothGatt != null) {
bluetoothGatt.writeCharacteristic(mByteCharacteristic);
}
}
}
///////////////确保:
mByteCharacteristic.getProperties() & BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE) != 0x0
否则,请尝试忽略setWriteType调用。默认情况下,该特征应使用正确的写入类型