views:

29

answers:

1

For my application i make a bluetooth discovery search to list all available bluetooth device in. If I'm in a room with a lot of computers etc, there is a really long list. So I'd like to filter Android phones from the lists.

I read the documentation under: http://developer.android.com/reference/android/bluetooth/BluetoothClass.Device.html and http://developer.android.com/reference/android/bluetooth/BluetoothClass.Device.Major.html

So I'm able to filter some devices like laptops, computers, etc.

Does anybody know what are the possible constants which android phones can have? I don't want to risk to filter too many devices, but I also want to limit the list to only Android devices.

Any hints?

+1  A: 

Bluetooth service classes are standardized. Depending on which bits are present in the class, you can detemrine whether the device is a computer or not. In fact, the class can expose a lot of useful information about each decice.

Have a look at the manpage for hcid.conf. This page describes how the class is built:

http://linux.die.net/man/5/hcid.conf

As stated in the above doc:

Example: class 0x02hhhh : the device offers networking service Major device class allocation:

0x00: Miscellaneous

0x01: Computer (desktop,notebook, PDA, organizers, .... )

EDIT: A few other notes:

  1. Android phones aren't in discoverable mode by default. So changes are, none of your discovered devices will ever be Android devices unless you have initiated discoverable mode on a device.

  2. Many phones can determine the RSSI (signal strength) of discovered devices. This information is passed to your app during discovery as a bundle extra. Nearby devices will generally have a higher RSSI than distant devices. So you can also filter by "how close the device is".

  3. The Bluetooth MAC used for various devices will be of certain ranges. The first three bytes of the Bluetooth MAC corresponds to the Hardware Vendor... There are many vendors, but most of them don't make bluetooth hardware for phones. So you could also filter by Bluetooth MAC - if it falls within a known range, it's probably an Android.

Brad Hein