edufolly / flutter_bluetooth_serial

A basic Flutter Bluetooth Serial
MIT License
476 stars 454 forks source link

Cannot communicate with another android device. #184

Open AlphaRosh opened 1 year ago

AlphaRosh commented 1 year ago

Hello, I'm attempting to connect and communicate with two Android smartphones.

For testing, I'm using a Vivo V20 Pro and a Samsung Galaxy Tab (SMT515). Both are running the sample serial app.

To duplicate:

1) Launch the app on both your phone and your tablet, and enable Bluetooth and location services on both.

2) Making one gadget discoverable and searching for it from another. (I am able to obtain the device and pair it.)

3) With both phone or tab, go to "Connect to paired device to chat" and select the device to chat.

When I try to chat with the connected device after connecting to it from vs, I receive the following exception

image

Exception has occurred. PlatformException (PlatformException(connect_error, read failed, socket might closed or timeout, read ret: -1, java.io.IOException: read failed, socket might closed or timeout, read ret: -1 at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:970) at android.bluetooth.BluetoothSocket.readInt(BluetoothSocket.java:984) at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:536) at io.github.edufolly.flutterbluetoothserial.BluetoothConnection.connect(BluetoothConnection.java:57) at io.github.edufolly.flutterbluetoothserial.BluetoothConnection.connect(BluetoothConnection.java:64) at io.github.edufolly.flutterbluetoothserial.FlutterBluetoothSerialPlugin$FlutterBluetoothSerialMethodCallHandler.lambda$onMethodCall$4$FlutterBluetoothSerialPlugin$FlutterBluetoothSerialMethodCallHandler(FlutterBluetoothSerialPlugin.java:1007) at io.github.edufolly.flutterbluetoothserial.-$$Lambda$FlutterBluetoothSerialPlugin$FlutterBluetoothSerialMethodCallHandler$DZLg1SWj2Aas0tcY7uTlx8xsy4Y.run(Unknown Source:10) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:923) , null))

Thanks

vytautas-pranskunas- commented 1 year ago

Same here

swordyy7 commented 1 year ago

Same here

dev9828 commented 1 year ago

hey? did you solve the issue? i cant connect two phone with same aplication.

SrinivasaMurthy91 commented 1 year ago

anyone solve the issue? i am unable to connect two mobiles

udit6023 commented 1 year ago

BluetoothConnection newConnection = await BluetoothConnection.toAddress(device.address); i have passed a raw device's address in the above code still it is not able to connect to that device were you able to connect to your desired device?

SrinivasaMurthy91 commented 1 year ago

I am unable to connect to desired device

On Sun, 11 Jun, 2023, 9:19 pm Udit Soni, @.***> wrote:

BluetoothConnection newConnection = await BluetoothConnection.toAddress(device.address); i have passed a raw device's address in the above code still it is not able to connect to that device were you able to connect to your desired device?

— Reply to this email directly, view it on GitHub https://github.com/edufolly/flutter_bluetooth_serial/issues/184#issuecomment-1586221662, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUGAM52NRTS7V5COFNQZVTTXKXSILANCNFSM6AAAAAASSXGXSE . You are receiving this because you commented.Message ID: @.***>

zamirszn commented 7 months ago

I'm facing this too has anyone been able to figure it out