Wednesday, June 8, 2011

Bluetooth Chat: One Server, Multiple Clients

In attempting to solve this issue, I believe I have successfully extended the official Android Bluetooth Chat example to work with a server connecting to multiple clients.

I've uploaded my modifications to github here:

https://github.com/polyclef/BluetoothChatMulti

One device acts as the server by selecting "Menu>Make discoverable". Each client then connects by selecting "Menu>Connect a device". I was successfully able to connect my Motorola Droid and HTC Eris as clients to my Samsung Galaxy Tab 10.1". Each message sent from a client displays only on the server. A message sent from the server displays on all clients.

This was a tedious process getting it to work at all. Connectivity with the HTC devices is sporadic, though. I've read elsewhere that bluetooth on HTC is buggy, so I'm chalking it up to that.

Hopefully someone else will find this example useful. If you have any questions, suggestions, or other feedback, please let me know.

3 comments:

  1. hi there is no menu option in this application

    ReplyDelete
  2. This is one of the progressive post.I like your blog instruction.This is one of the nice post.
    Android app developers

    ReplyDelete
  3. hello , im trying to implement bluetooth chat using pc and htc desire. My problem is that my Server(HTC)does not process after accept() call even after the PC shows that connection is made ! can u please help me ???

    ReplyDelete