# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Constants | Inherited Constants | Methods | Inherited Methods

# BluetoothHealth

`public final class BluetoothHealth`
`extends Object` `implements BluetoothProfile`

java.lang.Object
↳ | android.bluetooth.BluetoothHealth

This class is deprecated.
Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

Public API for Bluetooth Health Profile.

BluetoothHealth is a proxy object for controlling the Bluetooth Service via IPC.

How to connect to a health device which is acting in the source role.

- Use `BluetoothAdapter#getProfileProxy` to get the BluetoothHealth proxy object.
- Create an `BluetoothHealth` callback and call `registerSinkAppConfiguration(String, int, BluetoothHealthCallback)` to register an application configuration
- Pair with the remote device. This currently needs to be done manually from Bluetooth Settings
- Connect to a health device using `connectChannelToSource(BluetoothDevice, BluetoothHealthAppConfiguration)`. Some devices will connect the channel automatically. The `BluetoothHealth` callback will inform the application of channel state change.
- Use the file descriptor provided with a connected channel to read and write data to the health channel.
- The received data needs to be interpreted using a health manager which implements the IEEE 11073-xxxxx specifications.
- When done, close the health channel by calling `disconnectChannel(BluetoothDevice, BluetoothHealthAppConfiguration, int)` and unregister the application configuration calling `unregisterAppConfiguration(BluetoothHealthAppConfiguration)`

  ## Summary

  ### Constants
  `int` | `APP_CONFIG_REGISTRATION_FAILURE` This constant is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `int` | `APP_CONFIG_REGISTRATION_SUCCESS` This constant is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `int` | `APP_CONFIG_UNREGISTRATION_FAILURE` This constant is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `int` | `APP_CONFIG_UNREGISTRATION_SUCCESS` This constant is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `int` | `CHANNEL_TYPE_RELIABLE` This constant is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `int` | `CHANNEL_TYPE_STREAMING` This constant is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `int` | `SINK_ROLE` This constant is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `int` | `SOURCE_ROLE` This constant is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `int` | `STATE_CHANNEL_CONNECTED` This constant is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `int` | `STATE_CHANNEL_CONNECTING` This constant is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `int` | `STATE_CHANNEL_DISCONNECTED` This constant is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `int` | `STATE_CHANNEL_DISCONNECTING` This constant is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  ### Inherited constants
  From interface `android.bluetooth.BluetoothProfile`
  `int` | `A2DP` A2DP profile.
  `String` | `EXTRA_PREVIOUS_STATE` Extra for the connection state intents of the individual profiles.
  `String` | `EXTRA_STATE` Extra for the connection state intents of the individual profiles.
  `int` | `GATT` GATT
  `int` | `GATT_SERVER` GATT_SERVER
  `int` | `HEADSET` Headset and Handsfree profile
  `int` | `HEALTH` This constant is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `int` | `HEARING_AID` Hearing Aid Device
  `int` | `HID_DEVICE` HID Device
  `int` | `SAP`
  `int` | `STATE_CONNECTED` The profile is in connected state
  `int` | `STATE_CONNECTING` The profile is in connecting state
  `int` | `STATE_DISCONNECTED` The profile is in disconnected state
  `int` | `STATE_DISCONNECTING` The profile is in disconnecting state

  ### Public methods
  `boolean` | `connectChannelToSource(BluetoothDevice device, BluetoothHealthAppConfiguration config)` This method is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `boolean` | `disconnectChannel(BluetoothDevice device, BluetoothHealthAppConfiguration config, int channelId)` This method is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `List<BluetoothDevice>` | `getConnectedDevices()` Get connected devices for the health profile.
  `int` | `getConnectionState(BluetoothDevice device)` Get the current connection state of the profile.
  `List<BluetoothDevice>` | `getDevicesMatchingConnectionStates(int[] states)` Get a list of devices that match any of the given connection states.
  `ParcelFileDescriptor` | `getMainChannelFd(BluetoothDevice device, BluetoothHealthAppConfiguration config)` This method is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `boolean` | `registerSinkAppConfiguration(String name, int dataType, BluetoothHealthCallback callback)` This method is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`
  `boolean` | `unregisterAppConfiguration(BluetoothHealthAppConfiguration config)` This method is deprecated. Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  ### Inherited methods
  From class `java.lang.Object`
  `Object` | `clone()` Creates and returns a copy of this object.
  `boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
  `void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
  `final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
  `int` | `hashCode()` Returns a hash code value for the object.
  `final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
  `final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
  `String` | `toString()` Returns a string representation of the object.
  `final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
  `final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
  `final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.
  From interface `android.bluetooth.BluetoothProfile`
  `abstract List<BluetoothDevice>` | `getConnectedDevices()` Get connected devices for this specific profile.
  `abstract int` | `getConnectionState(BluetoothDevice device)` Get the current connection state of the profile Requires `Manifest.permission.BLUETOOTH`
  `abstract List<BluetoothDevice>` | `getDevicesMatchingConnectionStates(int[] states)` Get a list of devices that match any of the given connection states.

  ## Constants

  ### APP_CONFIG_REGISTRATION_FAILURE

      public static final int APP_CONFIG_REGISTRATION_FAILURE

  This constant is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Health App Configuration registration failure

  Constant Value: 1 (0x00000001)

  ### APP_CONFIG_REGISTRATION_SUCCESS

      public static final int APP_CONFIG_REGISTRATION_SUCCESS

  This constant is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Health App Configuration registration success

  Constant Value: 0 (0x00000000)

  ### APP_CONFIG_UNREGISTRATION_FAILURE

      public static final int APP_CONFIG_UNREGISTRATION_FAILURE

  This constant is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Health App Configuration un-registration failure

  Constant Value: 3 (0x00000003)

  ### APP_CONFIG_UNREGISTRATION_SUCCESS

      public static final int APP_CONFIG_UNREGISTRATION_SUCCESS

  This constant is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Health App Configuration un-registration success

  Constant Value: 2 (0x00000002)

  ### CHANNEL_TYPE_RELIABLE

      public static final int CHANNEL_TYPE_RELIABLE

  This constant is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Health Profile - Channel Type used - Reliable

  Constant Value: 10 (0x0000000a)

  ### CHANNEL_TYPE_STREAMING

      public static final int CHANNEL_TYPE_STREAMING

  This constant is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Health Profile - Channel Type used - Streaming

  Constant Value: 11 (0x0000000b)

  ### SINK_ROLE

      public static final int SINK_ROLE

  This constant is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Health Profile Sink Role the device talking to the health device.

  Constant Value: 2 (0x00000002)

  ### SOURCE_ROLE

      public static final int SOURCE_ROLE

  This constant is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Health Profile Source Role - the health device.

  Constant Value: 1 (0x00000001)

  ### STATE_CHANNEL_CONNECTED

      public static final int STATE_CHANNEL_CONNECTED

  This constant is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Health Channel Connection State - Connected

  Constant Value: 2 (0x00000002)

  ### STATE_CHANNEL_CONNECTING

      public static final int STATE_CHANNEL_CONNECTING

  This constant is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Health Channel Connection State - Connecting

  Constant Value: 1 (0x00000001)

  ### STATE_CHANNEL_DISCONNECTED

      public static final int STATE_CHANNEL_DISCONNECTED

  This constant is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Health Channel Connection State - Disconnected

  Constant Value: 0 (0x00000000)

  ### STATE_CHANNEL_DISCONNECTING

      public static final int STATE_CHANNEL_DISCONNECTING

  This constant is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Health Channel Connection State - Disconnecting

  Constant Value: 3 (0x00000003)

  ## Public methods

  ### connectChannelToSource

      public boolean connectChannelToSource (BluetoothDevice device,
                      BluetoothHealthAppConfiguration config)

  This method is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Connect to a health device which has the `SOURCE_ROLE`. This is an asynchronous call. If this function returns true, the callback associated with the application configuration will be called.

  Requires `Manifest.permission.BLUETOOTH` permission.

  Parameters
  `device` | `BluetoothDevice`: The remote Bluetooth device.
  `config` | `BluetoothHealthAppConfiguration`: The application configuration which has been registered using `registerSinkAppConfiguration(java.lang.String, int, android.bluetooth.BluetoothHealthCallback)`

  Returns
  `boolean` | If true, the callback associated with the application config will be called.

  ### disconnectChannel

      public boolean disconnectChannel (BluetoothDevice device,
                      BluetoothHealthAppConfiguration config,
                      int channelId)

  This method is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Disconnect a connected health channel. This is an asynchronous call. If this function returns true, the callback associated with the application configuration will be called.

  Requires `Manifest.permission.BLUETOOTH` permission.

  Parameters
  `device` | `BluetoothDevice`: The remote Bluetooth device.
  `config` | `BluetoothHealthAppConfiguration`: The application configuration which has been registered using `registerSinkAppConfiguration(java.lang.String, int, android.bluetooth.BluetoothHealthCallback)`
  `channelId` | `int`: The channel id associated with the channel

  Returns
  `boolean` | If true, the callback associated with the application config will be called.

  ### getConnectedDevices

      public List<BluetoothDevice> getConnectedDevices ()

  Get connected devices for the health profile.

  Return the set of devices which are in state `BluetoothProfile.STATE_CONNECTED`

  Requires `Manifest.permission.BLUETOOTH` permission. This is not specific to any application configuration but represents the connection state of the local Bluetooth adapter for this profile. This can be used by applications like status bar which would just like to know the state of the local adapter.

  Returns
  `List<BluetoothDevice>` | List of devices. The list will be empty on error.

  ### getConnectionState

      public int getConnectionState (BluetoothDevice device)

  Get the current connection state of the profile.

  Requires `Manifest.permission.BLUETOOTH` permission. This is not specific to any application configuration but represents the connection state of the local Bluetooth adapter with the remote device. This can be used by applications like status bar which would just like to know the state of the local adapter.

  Parameters
  `device` | `BluetoothDevice`: Remote bluetooth device.

  Returns
  `int` | State of the profile connection. One of `BluetoothProfile.STATE_CONNECTED`, `BluetoothProfile.STATE_CONNECTING`, `BluetoothProfile.STATE_DISCONNECTED`, `BluetoothProfile.STATE_DISCONNECTING`

  ### getDevicesMatchingConnectionStates

      public List<BluetoothDevice> getDevicesMatchingConnectionStates (int[] states)

  Get a list of devices that match any of the given connection states.

  If none of the devices match any of the given states, an empty list will be returned.

  Requires `Manifest.permission.BLUETOOTH` permission. This is not specific to any application configuration but represents the connection state of the local Bluetooth adapter for this profile. This can be used by applications like status bar which would just like to know the state of the local adapter.

  Parameters
  `states` | `int`: Array of states. States can be one of `BluetoothProfile.STATE_CONNECTED`, `BluetoothProfile.STATE_CONNECTING`, `BluetoothProfile.STATE_DISCONNECTED`, `BluetoothProfile.STATE_DISCONNECTING`,

  Returns
  `List<BluetoothDevice>` | List of devices. The list will be empty on error.

  ### getMainChannelFd

      public ParcelFileDescriptor getMainChannelFd (BluetoothDevice device,
                      BluetoothHealthAppConfiguration config)

  This method is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Get the file descriptor of the main channel associated with the remote device and application configuration.

  Requires `Manifest.permission.BLUETOOTH` permission.

  Its the responsibility of the caller to close the ParcelFileDescriptor when done.

  Parameters
  `device` | `BluetoothDevice`: The remote Bluetooth health device
  `config` | `BluetoothHealthAppConfiguration`: The application configuration

  Returns
  `ParcelFileDescriptor` | null on failure, ParcelFileDescriptor on success.

  ### registerSinkAppConfiguration

      public boolean registerSinkAppConfiguration (String name,
                      int dataType,
                      BluetoothHealthCallback callback)

  This method is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Register an application configuration that acts as a Health SINK. This is the configuration that will be used to communicate with health devices which will act as the `SOURCE_ROLE`. This is an asynchronous call and so the callback is used to notify success or failure if the function returns true.

  Requires `Manifest.permission.BLUETOOTH` permission.

  Parameters
  `name` | `String`: The friendly name associated with the application or configuration.
  `dataType` | `int`: The dataType of the Source role of Health Profile to which the sink wants to connect to.
  `callback` | `BluetoothHealthCallback`: A callback to indicate success or failure of the registration and all operations done on this application configuration.

  Returns
  `boolean` | If true, callback will be called.

  ### unregisterAppConfiguration

      public boolean unregisterAppConfiguration (BluetoothHealthAppConfiguration config)

  This method is deprecated.
  Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as `BluetoothGatt`, `BluetoothAdapter#listenUsingL2capChannel()`, or `BluetoothDevice#createL2capChannel(int)`

  Unregister an application configuration that has been registered using `registerSinkAppConfiguration(String, int, BluetoothHealthCallback)`

  Requires `Manifest.permission.BLUETOOTH` permission.

  Parameters
  `config` | `BluetoothHealthAppConfiguration`: The health app configuration

  Returns
  `boolean` | Success or failure.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*