Jeroen Beljaars
Jeroen Beljaars

Reputation: 167

Android: How to get more information of a bluetooth device?

Is it possible to get more information about bondedDevices besides the name and the MAC Address? So you can, for example, determine what device it exactly is (like a Gear S3 or Samsung Wireless Earbuds ect..). I can't seem to get this information but it must be possible, right?

Upvotes: 1

Views: 1949

Answers (1)

El Stepherino
El Stepherino

Reputation: 620

Not for "classic Bluetooth devices", as opposed to Bluetooth Low Energy (BLE) devices.

Information such as model number, manufacturer name, etc. are considered to be standard "GATT characteristics" of BLE devices.

Typically, you can "discover" all sort of information on the device after you've connected to its GATT server. Part of the connection process involves specifying a callback interface from which you can send requests for information on the GATT server's:

  • GATT services
  • GATT characteristics (for each GATT service)

A Bluetooth device that has been bonded-to will not contain the extra information you seek, other than name and MAC address.

What's more, I've found that it is unreliable (if not impossible) to truly bond with a BLE device.

To get the info you seek, you need to "discover" the GATT services and then for each service, list their GATT characteristics. Once you've mapped out the characteristics, you can then send read requests. Everything is done asynchronously, which is why your app must provide a callback interface to the initial 'BluetoothDevice.connectGatt' command.

If you need to hold on to this info for the future (when the device is not powered up), it is up to your app to save the discovered information somewhere (SQLite database, etc.)

One observation I've made, and much to my dismay, is that despite the fact that the Bluetooth Core Specification defines standard GATT characteristics, it doesn't mean that the device's manufacturer will follow the standard.

For instance, many of the Bluetooth (BLE) devices that measure "health" data don't use the GATT characteristics defined specifically for that purpose. They tend to define their own custom characteristics.

That being said, model number, manufacturer name, SW/HW/FW version numbers are pretty much standard.

Upvotes: 1

Related Questions