Android Bluetooth Cross Platform Interoperability
Solution 1:
I figured out what was going wrong. The problem is that you have to pair the remote device with the Android before you try to make the connection because the pairing dialog does not always work. I am not sure if the bug is on the Android side or on the other device's side, but I was never shown the dialog that asks for the authentication code or that displays the authentication code on either device. So it looks like there are some compatibility issues out there. But if you explictly pair the devices beforehand, then the connection works.
Solution 2:
You're right. I'm having the same issue here while trying to connect to an RS232 device with BluetoothChat sample program.
1- If not bonded, I get two errors in a row :
03-0313:38:20.020: ERROR/BluetoothService.cpp(2077): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session) // Probably because we're calling cancelDiscovery() as a "security" (it's already been cancelled at some point beforehand)03-0313:38:20.040: ERROR/BluetoothEventLoop.cpp(2077): onCreateDeviceResult: D-Bus error: org.bluez.Error.AlreadyExists (Device already exists) // This I don't understand
2- Once bonded through Bluetooth Settings, no problem. The connection is made perfectly and the program works.
I tried to check out the Android Source by myself but, given that I'm a newbie, it's kind of tough. If some experienced guy could work it out, it'd be great.
Solution 3:
To answer Tomas - The SPP (Serial Port Profile) profile is broken on several HTC Android models, even 2.1 versions, but it is not consistent among the models.
HTC Desire - Does not work. HTC Legend - Bad, but works for a while? HTC Hero with custom ROMs - Some work well, some not at all and some badly when doing sound at the same time.
Solution 4:
All the previous answers are on the mark; essentially, pairing is required before connect.
However, I was getting the error even after pairing. (I had first tried to connect without pairing).
The workaround was to reboot the phone once. And now it is able to connect to the paired device fine. Sounds simple, but I spent quite some time debugging it. Hopefully useful to someone out there.
Post a Comment for "Android Bluetooth Cross Platform Interoperability"