Skip to content

Commit

Permalink
[Fix] android: autoconnect could enter disconnect / connection loop
Browse files Browse the repository at this point in the history
  • Loading branch information
chipweinberger committed Mar 19, 2024
1 parent 0e9602b commit 6dd6fbe
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/src/flutter_blue_plus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,12 @@ class FlutterBluePlus {
// do not clear `bondState`, for faster performance.

// autoconnect
if (_autoConnect.contains(r.remoteId)) {
if (_adapterStateNow == BmAdapterStateEnum.on) {
var d = BluetoothDevice(remoteId: r.remoteId);
d.connect(autoConnect: true, mtu: null);
if (Platform.isAndroid == false) {
if (_autoConnect.contains(r.remoteId)) {
if (_adapterStateNow == BmAdapterStateEnum.on) {
var d = BluetoothDevice(remoteId: r.remoteId);
d.connect(autoConnect: true, mtu: null);
}
}
}
}
Expand Down

0 comments on commit 6dd6fbe

Please sign in to comment.