Android Bluetooth: Service Discovery Failed, connection to Desktop/Laptop
Asked Answered
N

1

0

I have an Android app that I had working a few months ago which I could use to connect my Droid X2 to an ASUS Transformer tablet over Bluetooth. That connection worked fine.

I just finished coding client/server pairs using PyBlueZ on a couple Ubuntu machines, and an analogous client/server pair using BlueCove on a Windows machine.

I thought it would be a breeze to take these three working, tested systems and connect them. Unfortunately, I am currently unable to connect my Droid X2 to my other machines, nor can I connect my other machines to my Droid X2 (I no longer have the ASUS Transformer). I can, however, connect my PyBlueZ client/server pair to my BlueCove client/server pair without issue.

Are there any known intricacies when connecting Android devices to desktops/laptops? Any additional information that must be provided, or differing formats in communication? I'm trying to connect using an insecure rfcomm channel to a service listing. I am using the same UUID on both sides. And, again, I had this exact insecure rfcomm service connection working between my Droid X2 and an ASUS Transfomer.

One interesting aspect is that even though all systems use the UUID, my PyBlueZ and BlueCove implementations also have a service name, but Android does not ask for a service name to connect to a service, only the UUID. Could that be an issue?

Thanks.

Nealy answered 24/3, 2012 at 7:9 Comment(0)
N
1

The error I was getting was Connection Refused when trying to connect over a bluetooth socket to my other devices. After much pain and research, I found that I could manually unpair my computers from my phone and then the bluetooth socket connects fine.

The strange thing is that I never even paired those devices, so I don't know how they got that way. But if you are getting Connection Refused, see if your Android device is paired to the machine you're connecting to, then manually unpair it, then try connecting with a bluetooth socket again.

Hope this saves someone a few hundred hours...

Nealy answered 29/3, 2012 at 5:36 Comment(3)
Can you elaborate on that? I seem to have a similar problem! It seems that Android forgets to update newly negociated Bluetooth link keys of an already paired device, or something like that. What kind of socket were you opening? Secure or insecure?Spawn
Unfortunately, I don't know enough about Bluetooth to comment on "link keys." I was trying to create an insecure connection from my Droid X2 to 3 computers, but I tired secure too. Each attempt failed with "Connection Refused." Initially I was getting "Service Discovery Failed", but for some unknown reason the error eventually changed. After much searching I found a post that mentioned manually unpairing devices (I don't have the link anymore). I tried unpairing out of frustration and somehow doing that allowed my connection attempt to go through. I continue to be perplexed by this.Nealy
I will figure it out eventually, I have a bluetooth chip on a custom pre-production hardware...I must find out why this bug occurs. All I can say so far is this: connection works ok after pairing(does not matter who starts the pairing process). The issue is after my device is powered off. It will want to renegociate link keys (reauthenticate). It does this, but Android closes the connection afterwards instead of accepting(no error message).Spawn

© 2022 - 2024 — McMap. All rights reserved.