Good night!
I'm studying the Bluetooth API and I'm facing a problem when trying to
connect and pair to bluetooth devices. After a lot of research, I've found
that after Jelly Bean, bluetooth doesn't work the same way and I've found
the following code that could overcome the pairing problem:
Method m = device.getClass().getMethod("createRfcommSocket", int.class);
socket = (BluetoothSocket)m.invoke(device, 1);
Now, have last the connection problem. The problem comes when I call
socket.connect(). It throws the following exception: "java.io.IOException:
read failed, socket might closed or timeout, read ret: -1”.
OBS: App tested in android KitKat (4.4) and Lollipop (5.1), besides a
shield Bluetooth for arduino.
--
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-developers/78ff1764-c4dd-4e78-8f3d-b4f99f866419%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.