What are the bluetooth device classes of android phones?
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?
2 Answers 2
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:
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, . )
- Android phones aren’t in discoverable mode by default. So chances are, none of your discovered devices will ever be Android devices unless you have initiated discoverable mode on a device.
- 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».
- 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.
Bluetooth Device Class
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a remote Bluetooth device.
[Android.Runtime.Register("android/bluetooth/BluetoothDevice", DoNotGenerateAcw=true)] public sealed class BluetoothDevice : Java.Lang.Object, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable
[] type BluetoothDevice = class inherit Object interface IParcelable interface IJavaObject interface IDisposable interface IJavaPeerable
Remarks
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Fields
Broadcast Action: Indicates a low level (ACL) connection has been established with a remote device.
Broadcast Action: Indicates a low level (ACL) disconnection from a remote device.
Broadcast Action: Indicates that a low level (ACL) disconnection has been requested for a remote device, and it will soon be disconnected.
Broadcast Action: Indicates the alias of a remote device has been changed.
Broadcast Action: Indicates a change in the bond state of a remote device.
Broadcast Action: Bluetooth class of a remote device has changed.
Broadcast Action: Remote device discovered.
Broadcast Action: Indicates the friendly name of a remote device has been retrieved for the first time, or changed since the last retrieval.
Broadcast Action: This intent is used to broadcast PAIRING REQUEST
Broadcast Action: This intent is used to broadcast the UUID wrapped as a android.os.ParcelUuid of the remote device after it has been fetched.
Hardware MAC Address of the device
Address is either resolvable, non-resolvable or static.
Bluetooth device type, Classic — BR/EDR devices
Bluetooth device type, Dual Mode — BR/EDR/LE
Bluetooth device type, Low Energy — LE-only
Bluetooth device type, Unknown
Sentinel error value for this class.
Used as an int extra field in #ACTION_BOND_STATE_CHANGED intents.
Used as a Parcelable BluetoothClass extra field in #ACTION_FOUND and #ACTION_CLASS_CHANGED intents.
Used as a Parcelable BluetoothDevice extra field in every intent broadcast by this class.
Used as a String extra field in #ACTION_NAME_CHANGED and #ACTION_FOUND intents.
Used as an int extra field in #ACTION_PAIRING_REQUEST intents as the value of passkey.
Used as an int extra field in #ACTION_PAIRING_REQUEST intents to indicate pairing method used.
Used as an int extra field in #ACTION_BOND_STATE_CHANGED intents.
Used as an optional short extra field in #ACTION_FOUND intents.
Used as an extra field in #ACTION_UUID intents, Contains the android.os.ParcelUuid s of the remote device which is a parcelable version of UUID .
The user will be prompted to confirm the passkey displayed on the screen or an app will confirm the passkey for the user.
The user will be prompted to enter a pin or an app will enter a pin for user.
Properties
Returns the hardware address of this BluetoothDevice.
Get the locally modifiable name (alias) of the remote Bluetooth device.
Get the Bluetooth class of the remote device.
Get the bond state of the remote device.
Returns the runtime class of this Object .
The handle to the underlying Android instance.
Get the friendly Bluetooth name of the remote device.
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
Get the Bluetooth device type of the remote device.
Methods
Creates and returns a copy of this object.
Connect to GATT Server hosted by this device.
Connect to GATT Server hosted by this device.
Connect to GATT Server hosted by this device.
Connect to GATT Server hosted by this device.
Start the bonding (pairing) process with the remote device.
Create a Bluetooth L2CAP Connection-oriented Channel (CoC) BluetoothSocket that can be used to start a secure outgoing connection to the remote device with the same dynamic protocol/service multiplexer (PSM) value.
Create an RFCOMM BluetoothSocket socket ready to start an insecure outgoing connection to this remote device using SDP lookup of uuid.
Create a Bluetooth L2CAP Connection-oriented Channel (CoC) BluetoothSocket that can be used to start a secure outgoing connection to the remote device with the same dynamic protocol/service multiplexer (PSM) value.
Create an RFCOMM BluetoothSocket ready to start a secure outgoing connection to this remote device using SDP lookup of uuid.
Describe the kinds of special objects contained in this Parcelable’s marshalled representation.
Indicates whether some other object is «equal to» this one.
Perform a service discovery on the remote device to get the UUIDs supported.
Returns a hash code value for the object.
Returns the supported features (UUIDs) of the remote device.
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
Wakes up a single thread that is waiting on this object’s monitor.
Wakes up all threads that are waiting on this object’s monitor.
Sets the locally modifiable name (alias) of the remote Bluetooth device.
Confirm passkey for #PAIRING_VARIANT_PASSKEY_CONFIRMATION pairing.
Set the pin during pairing when the pairing method is #PAIRING_VARIANT_PIN
Returns a string representation of the object.
Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.
Causes the current thread to wait until either another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object, or a specified amount of time has elapsed.
Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
Flatten this object in to a Parcel.
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
Performs an Android runtime-checked type conversion.
Bluetooth Class. Device Class
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Defines all device class constants.
[Android.Runtime.Register("android/bluetooth/BluetoothClass$Device", DoNotGenerateAcw=true)] public class BluetoothClass.Device : Java.Lang.Object
[] type BluetoothClass.Device = class inherit Object
Remarks
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Constructors
A constructor used when creating managed representations of JNI objects; called by the runtime.
Fields
Properties
Returns the runtime class of this Object .
The handle to the underlying Android instance.
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
Methods
Creates and returns a copy of this object.
Indicates whether some other object is «equal to» this one.
Returns a hash code value for the object.
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
Wakes up a single thread that is waiting on this object’s monitor.
Wakes up all threads that are waiting on this object’s monitor.
Returns a string representation of the object.
Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.
Causes the current thread to wait until either another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object, or a specified amount of time has elapsed.
Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
Performs an Android runtime-checked type conversion.