Skip to content

Commit e03e4e0

Browse files
committed
fix: 系统蓝牙关闭时清空数据,避免重新开启蓝牙后重新连接设备出现设备已连接错误
1 parent dbfc8e1 commit e03e4e0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

android/src/main/java/com/pauldemarco/flutter_blue/FlutterBluePlugin.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,8 @@ public void onReceive(Context context, Intent intent) {
728728
BluetoothAdapter.ERROR);
729729
switch (state) {
730730
case BluetoothAdapter.STATE_OFF:
731+
// 系统蓝牙关闭时清空数据,避免重新开启蓝牙后重新连接设备出现设备已连接错误
732+
mDevices.clear();
731733
sink.success(Protos.BluetoothState.newBuilder().setState(Protos.BluetoothState.State.OFF).build().toByteArray());
732734
break;
733735
case BluetoothAdapter.STATE_TURNING_OFF:

0 commit comments

Comments
 (0)