flutter_bluetooth_serial
flutter_bluetooth_serial copied to clipboard
Flutter_Bluetooth_Serial getBluetoothService() called with no BluetoothManagerCallback Error
I am trying to connect to bluetooth device using flutter bluetooth serial library ^0.2.2, on flutter 1.20.2, but everytime I run the code, I get the following error:
C:\Users\Me>...
D/FlutterBluePlugin(16512): Starting discovery
D/BluetoothAdapter(16512): startDiscovery
D/BluetoothAdapter(16512): startDiscovery = true
D/FlutterBluePlugin(16512): Discovered B8:27:EB:C9:45:29
D/FlutterBluePlugin(16512): Discovery finished
D/BluetoothAdapter(16512): cancelDiscovery
D/BluetoothAdapter(16512): cancelDiscovery = true
D/FlutterBluePlugin(16512): Canceling discovery (stream closed)
D/BluetoothAdapter(16512): cancelDiscovery
D/BluetoothAdapter(16512): cancelDiscovery = true
D/FlutterBluePlugin(16512): Connecting to B8:27:EB:C9:45:29 (id: 3)
D/BluetoothAdapter(16512): cancelDiscovery
D/BluetoothAdapter(16512): cancelDiscovery = true
D/BluetoothUtils(16512): isSocketAllowedBySecurityPolicy start : device null
D/BluetoothSocket(16512): connect(): myUserId = 0
W/BluetoothAdapter(16512): getBluetoothService() called with no BluetoothManagerCallback
E/System (16512): Uncaught exception thrown by finalizer
E/System (16512): java.io.IOException: socket not created
E/System (16512): at android.net.LocalSocketImpl.shutdownInput(LocalSocketImpl.java:396)
E/System (16512): at android.net.LocalSocket.shutdownInput(LocalSocket.java:206)
E/System (16512): at android.bluetooth.BluetoothSocket.close(BluetoothSocket.java:793)
E/System (16512): at android.bluetooth.BluetoothSocket.finalize(BluetoothSocket.java:308)
E/System (16512): at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:217)
E/System (16512): at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:200)
E/System (16512): at java.lang.Thread.run(Thread.java:818)
E/System (16512): Uncaught exception thrown by finalizer
E/System (16512): java.io.IOException: socket not created
E/System (16512): at android.net.LocalSocketImpl.shutdownInput(LocalSocketImpl.java:396)
E/System (16512): at android.net.LocalSocket.shutdownInput(LocalSocket.java:206)
E/System (16512): at android.bluetooth.BluetoothSocket.close(BluetoothSocket.java:793)
E/System (16512): at android.bluetooth.BluetoothSocket.finalize(BluetoothSocket.java:308)
E/System (16512): at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:217)
E/System (16512): at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:200)
E/System (16512): at java.lang.Thread.run(Thread.java:818)
My code to connect the device is...
Future<void> connect(address) async {
BluetoothConnection.toAddress(address).then((conn){
print("Connected to device $address");
conn.input.listen((Uint8List event) {
print(event);
}).onDone(() {
print("Closing connection");
conn.close();
});
showDialog(context: context, builder: (d){
return AlertDialog(
title: Text("Connection Successful"),
content: Text("Connected to device $address"),
actions: [
FlatButton(
child: Text("Ok"),
onPressed: (){
Navigator.pop(context);
},
)
],
);
});
})
.catchError((error){
showDialog(context: context, builder: (d){
return AlertDialog(
title: Text("Connection Problem!", style: TextStyle(color: Colors.red,),),
content: Text("There was an error connecting to device $address", style: TextStyle(color: Colors.grey[600]),),
actions: [
FlatButton(
child: Text("Ok"),
onPressed: (){
Navigator.pop(context);
},
)
],
);
});
});
}
What Android version are you using?
What Android version are you using?
Well, I ran the app on both "Android 6 and 7", all to notice the same!
When will you resolve this issue. I need to connect my BT headsets for live audio transmission. but on connection I get this error.
Could you solve this problem? I also face with this error. I run Android app on two android device and they cannot connect to chat.
No sorry. I have stop using flutter as there was no fine solution to this problem on internet.
On Fri, Jan 8, 2021, 1:40 PM Patzu [email protected] wrote:
Could you solve this problem? I also face with this error. I run Android app on two android device and they cannot connect to chat.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edufolly/flutter_bluetooth_serial/issues/101#issuecomment-756626873, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG5QVMOYIBG3CLNYUMT6DPDSY3AG5ANCNFSM4QXVMOQA .
Same here. Using android 10.
Same here. Using android 8.0.
Has anyone solved this problem?
Anyone solved this issue?