Closed anupamjuit closed 4 years ago
bluetooth communication sometimes fails with strange errors. No additional details are reported by Android libraries, so I also do not know the root cause. Typically it works when you try again, pair again, reboot devices, ...
Thank you for your responce.
Hi! I found something like this: When I try to connect with Developer Sample Bluetooth Cat Application it's only connecting with an insecure socket, and by changing the UUID for insecure one it works. look in this matter.
are you talking about bluetooth classic (this repo) or bluetooth LE (my SimpleBluetoothLETerminal repo)? UUID looks more like Bluetooth LE
I am working with classici one. private static final UUID BLUETOOTH_SPP = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
In this sample (https://github.com/android/connectivity-samples/tree/master/BluetoothChat/#readme) I am able to connect. But only with Connect a device-Insecure mode.
this app uses the Bluetooth Serial Port Profile where createRfcommSocketToServiceRecord
is the right method. As you are using different UUID you might also have to use different methods.
simple_bluetooth_terminal D/BluetoothSocket: close() this: android.bluetooth.BluetoothSocket@f5058ae, channel: 1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@4cef64f, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@b4521dcmSocket: android.net.LocalSocket@8e8a2e5 impl:android.net.LocalSocketImpl@c2ea86b fd:java.io.FileDescriptor@4f07fc8, mSocketState: INIT
I am getting this error. And in the mobile window, I am getting: connecting....connection failed: read failed, socket might closed or timeout, read ret: -1
Help please