-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot connect to socket via bluetooth - JVM exception occurred: read failed, socket might closed or timeout, read ret: -1 #314
Comments
I am having the same issue using similar code. Has any solution been found? |
I am facing the same error too, has any of you found a solution yet? |
For me the issue was that I didn't use '00001101-0000-1000-8000-00805F9B34FB' |
This is not a PyJNIus bug, it's a normal Java error. However, take a look at this answer and you might find the solution. |
Can't understan how to fix the problem in kivy please help me thank you |
Me too. Could somebody help? |
The problem is that when you use UUID to create a
2] Use java class Hope this helps, because when I originally clicked on this link, the drips and drabs of linked answers was quite political. |
Hello guys, |
AttributeError: 'android.bluetooth.BluetoothSocket' object has no attribute 'port' |
I also has had this error following the solution by @Hmerman6006 Maybe in three years the API in Python changed? |
Is there any solution i ma facing same problem ! request_permissions([Permission.BLUETOOTH_CONNECT,\
Permission.BLUETOOTH_SCAN,Permission.BLUETOOTH,\
Permission.BLUETOOTH_ADMIN,], callback)
def get_socket_stream(name):
paired_devices = BluetoothAdapter.getDefaultAdapter().getBondedDevices().toArray()
socket = None
for device in paired_devices:
print("#"*20)
print(device.getName(),device.getAddress())
if device.getName() == name:
print("name matched")
show_toast("Name match!!!!!!!!!!")
#int_class = IntegerClass.TYPE
uuid=UUID.fromString("00001101-0000-1000-8000-00805F9B34FB")
socket = device.createInsecureRfcommSocketToServiceRecord(uuid)
BluetoothAdapter.getDefaultAdapter().cancelDiscovery()
#createRfcommSocketToServiceRecord(uuid)
#c=AndroidString("createRfcommSocket")
#create_rfcomm_socket_method = device.getClass().getMethod(c, [int_class])
# Invoke the method with the required argument
#socket = create_rfcomm_socket_method.invoke(device, 1)
print(socket)
socket.connect() i got same error |
Description
I am trying to connect to bluetooth module HC-06 from android device. The code below will successfully detect paired devices but will not connect - raising "JVM exception occurred: read failed, socket might closed or timeout, read ret: -1".
Code and Logs
Permissions
Here is example function taking name of bluetooth device as arg.
The text was updated successfully, but these errors were encountered: