• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Bluetooth Connection Refused

I am trying to connect my Droid X2 to my Windows 7/BlueCove Bluetooth server. I previously had my Droid X2 connecting to an ASUS Transformer so I know its possible to connect my Droid X2 to another system.

However, when I try to connect to my Windows machine, my Droid X2 sees the machine, but when I try to connect to a service that my laptop is running I get

IOException: Connection refused

My BlueCove server has been tested using other computers and works fine. Any idea what might be causing this?

If it matters I am using:

Code:
device.createInsecureRfcommSocketToServiceRecord(SERVICE_UUID);

Thanks.
 
I just tried with a secure connection and I'm getting the same result. Although, I didn't do any pairing or anything before that....do I need to do any special pairing for a secure connection? I thought that was the point.
 
Ok....after a couple weeks of dealing with this issue I just found a workaround based on another post I found somewhere online:

I went and unpaired my windows laptop from my phone and retried an insecure connection. It worked immediately. Now I'm no longer sure what being "paired" means - I never entered any code or asked the system to pair with those devices....yet there they were, all of my computers were shown as being paired devices....

Obviously I cannot ask users to continuously unpair devices to make my app work....does anyone have a clue why pairing/unpairing would have anything to do with the success of a connection? I am very perplexed here.
 
If you find the answer to that, let me know as I've always had to tell users to unpair on occasion with my bluetooth apps.

What UUID are you using btw? (SERVICE_UUID)
 
I'm using a UUID that I generated online...nothing special. Are there certain guidelines for creating UUIDs for certain types of tasks (like HID for example)? Even though I've coded up client/server pairs in Python and Java, I'm still at the 2% level of Bluetooth understanding. I have seen threads around that seem to indicate that if you are offering HID interaction then you want to start with a certain sequence in your UUID, perhaps a similar thing for OBEX related functionality. Any truth to that?

So far I've been very disappointed with Android bluetooth support. My current app idea requires the ability to be in permanent discovery mode to really take advantage of the system....when I found out that wasn't even possible on Android I almost threw my phone through a wall. Now there is this completely unnecessary and inexplicable need to manually unpair devices for success. Irritating!

By the way do you know any good introductory resources for Bluetooth? Especially as it pertains to Android? So far I've been googling one question/issue after another, trying to build up my knowledge that way....but thats a steep hill to climb. I would be especially interested to find out how to incorporate profiles like OBEX into my own application because had I figured out how to use OBEX inside my application, my work would have been reduced by 95%.
 
Some UUIDs have specific meanings, but generally you're supposed to be better off with your own, like you did.

The one in the Bluetooh Chat API demo for instance, is the "general" SPP (serial port profile) i think. Sometimes this may work better. I dont know much about BlueCove though.

Unfortunately the problem with Bluetooth is one of the few places that fragmentation comes into play. Windows uses a different BT stack than Android, and HTC uses a different BT stack than Moto, and so on. So sometimes there can be strange errors.
 
Back
Top Bottom