LenhartStephan / flutter_blue_classic

A Bluetooth Classic Plugin for Flutter
https://pub.dev/packages/flutter_blue_classic
GNU General Public License v3.0
4 stars 1 forks source link

Not able to connect to android tv #5

Open codex-bipin opened 1 month ago

codex-bipin commented 1 month ago

I am trying to connect to a android tv but not able to connect , it is giving me below error

E/flutter (10787): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(connect_error, read failed, socket might closed or timeout, read ret: -1, null, null) E/flutter (10787): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:648:7) E/flutter (10787): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18) E/flutter (10787): E/flutter (10787): #2 MethodChannelFlutterBlueClassic.connect (package:flutter_blue_classic/src/flutter_blue_classic_method_channel.dart:109:9) E/flutter (10787): E/flutter (10787): #3 _MainScreenState._connectToDevice (package:flutter_blue_classic_example/main.dart:90:20) E/flutter (10787):

LenhartStephan commented 1 month ago

Could you please specify what the expected behavior is?

Just as a friendly reminder: You can only connect to a remote device (the tv box), if the other device is accepting a connection (=> has an active Bluetooth server). You can think of it like this: Every computer on a network has an IP-Adress and you can make a HTTP-GET request to it. But unless the computer has a running HTTP-Server, the request will result in a Connection-Refused Error.

codex-bipin commented 4 weeks ago

Yes other device is accepting the connection as i tried with kotlin code so it is working fine and also through our mobile it is working fine but when i am trying it from this code then it is giving me the error.

LenhartStephan commented 3 weeks ago

Well, your exception is suggestion, that the remote client is not accepting the Bluetooth connection, which is not an error of this package.

Just to be sure, I've just run the example app and tried to connect to an android tv box and got the exact same error, because the box is not running software (an app) that would accept a connection, but rather has bluetooth enabled for accessoires (remote, headphones).

codex-bipin commented 3 weeks ago

No you mis-understood this thing. What i meant is TV is connecting with other devices like my phone's bluetooth and other's mobiles but not through this package.

LenhartStephan commented 2 weeks ago

Again: Connecting though a system dialog is not the same as establishing a socket connection. And you haven't told me what you want to accomplish anyway...