23

I'm new to Android. I'm looking for some code samples for Android Bluetooth programming. Could you please post them for me? Any useful link would be appreciated.

Sam R.
  • 16,027
  • 12
  • 69
  • 122
lawmeyian
  • 231
  • 1
  • 2
  • 3

3 Answers3

24

I realize this is an old thread, but I thought I'd jot some notes. The Android Bluetooth example (already listed) has a bunch of issues (not the least of which is you need 2 Android devices to get it to function).

Take a look at the example at http://luugiathuy.com/2011/02/android-java-bluetooth/ where he is using BlueTooth on the Android device to hit a server (to do some robotics work).

Be aware of UUID issues (the way that BlueTooth decides what connection it can make is defined in the UUID), and check out http://www.avetana-gmbh.de/avetana-gmbh/produkte/doc/javax/bluetooth/UUID.html

Keep in mind that the 16 bits represented in the UUID (ie, 0x1101 for Serial Port) is misleading in that its really the least significant part and needs to be coded 0x00001101.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Stuart Siegler
  • 1,686
  • 4
  • 30
  • 38
  • 2
    thank you for posting this... it's so frustrating not knowing whether or not you are going about implementing bluetooth correctly, and even more frustrating trying to find some good code examples online. thanks for the information! – Alex Lockwood Feb 06 '12 at 01:30
6

Check out android's tutorial for bluetooth.

BTW, this is first result on google for android bluetooth example

MByD
  • 135,866
  • 28
  • 264
  • 277
4

check this example, it sends bipmap+text over 2 bluetooth android devices.

if you want the full project example and working download freely from:

http://letitbit.net/download/19347.172fecf1b1790bfbd64b4d2115a6/sendobject.rar.html

maybe this can help to all people with problems sending over bluetooth with Android...

Thanks to Pedro Fraca for his great help on this work.