-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Example: Cannot connect to device after device.disconnect() #492
Comments
can you post all the logs? |
Updated the log. If I Hot Restart the app (Debug Mode), I can connect to device again, and I cannot connect to device after disconnection (same behavior occur). |
I have this same problem. |
I just tried to reproduce this (Android 12), and I did not have a problem. Maybe limited to older android? |
I can see in the logs, This could be a UI problem in the example app. Can you please share a video recording of what is happening? Thank you. Also, after taking a recording, please try updating to 1.14.4 |
I am using flutter_blue_plus: ^1.14.1 and Android 7.0. That is the error when I try to connect again after disconnecting:
I also try the 1.14.4 but got the error:
|
5s timeout is too short. try 35s also: i thought i changed the default timeout in 1.14.4, did you set 5s yourself? |
ScreenRecording_20230812_155646.mp4If I Hot Reload the App after disconnection, it will show the following log:
Also, it will not recover even I switch the Bluetooth On/Off. The Console keeps show
|
Thanks for sharing the video :) It looks like you are making a custom app based on the example app? Does the stock example app have this problem? |
I am not sure my app is based on the example app. My app use another project (ancient flutter_blue) as a background.
|
I may find the problem. In v1.13.4, the In example/main.dart: In example/pubspec.yaml" Log using v1.13.4
Log using v1.14.7
|
Can you explain this more? what do you mean "can be called twice"? |
in 1.14.x, if you call in 1.13.x if you call perhaps this is causing your app to misbehave. I should probably undo this change. |
v1.13.4 v1.14.7 |
I changed the timeout but it continues with the problem, also getting another error: `I/BluetoothLeScanner(23774): startRegisteration: mLeScanClients={com.boskokg.flutter_blue_plus.FlutterBluePlusPlugin$3@2c7e4e0=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@c18e399} ,callback=com.boskokg.flutter_blue_plus.FlutterBluePlusPlugin$3@2c7e4e0 I/View (23774): Key down dispatch to io.flutter.embedding.android.FlutterView{c9dce02 VFE...... .F...... 0,0-720,1184 #1}, event = KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_BACK, scanCode=0, metaState=0, flags=0x48, repeatCount=0, eventTime=4685789, downTime=4685789, deviceId=-1, source=0x101 } I/art (23774): Do partial code cache collection, code=14KB, data=30KB E/flutter (23774): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: FlutterBluePlusException: connect: (code: 6) Timed out after 35s |
why does connect become unavailable? are you able to add some more print statements and debug breakpoints to analyze what is happening? where does connect get stuck? |
@joaogbp please open a new issue. Are you able to connect using other BLE scanner apps? |
I'm also having the same issue after updating to v1.14.7 when i tried to re-connect after disconnected, the somehow @project2021-code workaround is working for me, making sure the disconnect doesn't called twice
|
Yes. |
Not sure if this help
example/lib/main.dart Line 404
It seems that it stopped at the second Update |
Hey @chipweinberger the v1.14.7 now solved my problem. Now I can connect after disconnect without need to rebuild the App. Thanks for your attention @chipweinberger! That's the best BLE plugin for Flutter! |
Ops! I just got the error again, now I can connect 2 times (connect and disconnect) but then i can not connect again. |
@joaogbp , can you try master branch? I am not reproducing the problem on android on master branch. It may be fixed now. Please post logs from master branch too.
To test, I changed the example app to call connect and disconnect twice in a row like this. But you should test in your app.
and
|
@joaogbp once you report back i will release 1.14.8 |
@chipweinberger I can confirm that the problem is solved in the master branch. I have also tested in my app, and I can connect/disconnect the ESP32. In the example app log:
|
It just worked on master branch!! I can now connect and disconnect more than 2 times... |
1.14.8 is released. Open a new issue if you still have problems. |
@chipweinberger This error still persists, after disconnecting, it is not possible to connect again, on any other device, and can only be connected after restarting. Log D/FBP-Android: [FBP] onMethodCall: connect |
I don't have this problem on my app or my device. Given the error There is not much FBP can do to help your situation. You probably need some special tools to figure it out. |
@chipweinberger I tested on 3 different devices, with different android versions, tested with android 10, 11 and 13 |
try different FBP versions? but tbh, I don't think this is a problem with FBP |
@chipweinberger I tested version 1.31.8, but as I was giving this error, I updated to the latest version 1.31.10, I tested it on 3 devices as I said, but it was from the same brand as Xiaomi, the only difference from the error returned, in the Android versions was that on Android 10, the error code was 133, on Android 13, it was 255, as you can see, in my first message. |
I am experiencing the same issue, is there any update on this? |
FlutterBluePlus Version
1.14.3
Flutter Version
3.10.6
What OS?
Android
OS Version
Android 8
What happened?
In FlutterBluePlus 1.13.4, I can connect to device after disconnection.
If I use the latest 1.14.3, I cannot connect to device after disconnection. It keeps loop the following msg on Android Studio Console.
Logs
The text was updated successfully, but these errors were encountered: