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.
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...
来源:https://stackoverflow.com/questions/9849852/android-bluetooth-service-discovery-failed-connection-to-desktop-laptop