I am just testing Bluetooth Chat sample SDK from http://developer.android.com/resources/samples/BluetoothChat/index.html. It works fine in some android phones (of course, 2.1 or higher), but I found problems about 开发者_如何学Gosynchronization or connection between any models. Apperars missages like: "Unable to connect device" or something like that: "An error occured while synchronizing":
Samsung Galaxy S (2.2.1) <----> Samsung Galaxy S (2.2.1). OK.
Samsung Galaxy S (2.2.1) <----> Samsung Galaxy 3 (2.2.1). OK.
Samsung Galaxy S (2.2.1) (SERVER) ----> HTC Tatoo (2.2.1) (CLIENT) OK.
HTC Tatoo (2.2.1) (SERVER) ----> Samsung Galaxy S (2.2.1) (CLIENT) Unable to connect device
Samsung Galaxy S (2.2.1) <----> HTC Wildfire (2.2.1). Synchro error.
The app was downloded from android-sdk and compiled in Eclipse Helios obtaining BluetoothChat.apk file. Then It was installed to these phones above indicated. I thought this app must be compatible with any phone with bluetooth and android 2.1 O.S. or higher. May I be wrong?
Any idea it would be grateful.
Thank you.
EDITED:
Samsung Galaxy S (2.2.1) (SERVER)----> HTC Wildfire (2.2.1) (CLIENT). OK It's impossible to pair from BluetoothChat app. Then, I have paired them from O.S. Wilsfire. Adjusts --> Wireless and Nets Connections --> Bluetooth Adjusts ---> Search devices. Now I can connect and chat with them from BluetoothChat app if the Galaxy S tries to connect to HTC Wildfire. Otherwise there is not success.
EDITED 15/04/2011:
Samsung Galaxy S (2.2.1) ----> HTC Tatoo (2.2.1). OK
As HTC Wildfire, only it is possible if Galaxy S tries connect to Tatoo.
It is true that sometimes I can connect at first time and sometimes at second, third time and even never. Then I have to unpair from Ajusts, Wireless, Bluetooth Adjusts and then turn back to pair. It' s very strange.
Definitely sounds like compatibility issues - which is rather sad. The problem is that many device makers change the underlying bluetooth from BlueZ to other stacks and that breaks the APIs or their behavior. Its impossible to find what (and if any) changes the devices makes on the android software under the hood
I have had reported issues getting a game I wrote to connect reliably via bluetooth using that code as a base. The most reliable voodoo dance i had to get different phones to connect was via the following:
1) Both players startup activity that has the Bluetooth functionality
1a) If the devices have never been paired, one player should use the context menu hardbutton in Bluetooth Game and set their device discoverable
2)The other player should then use the context menu hard button in
Bluetooth Game and select Connect a device, then select the other phone
from the discovered device list. The game will start automatically at that point.
**Do not have the phones pre-paired before starting bluetooth game.**
I hope I didn't change my code base so far from the example this doesn't make any sense in your context.. It was about a year and 1/2 ago....
I've found that on different devices with the same android version bluetooth works differently. As of Bluetooth Chat, it worked always for me with Motorola Droid and Samsung Galaxy, but sometimes threw a "serversocket closed" or similar exception with HTC Hero (in pair with Droid or Galaxy). I searched this problem on SOF and found that alot of people complain about bad bluetooth support on HTC phones.
精彩评论