Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public interface

BluetoothProfile

android.bluetooth.BluetoothProfile
Known Indirect Subclasses

Class Overview

Public APIs for the Bluetooth Profiles.

Clients should call getProfileProxy(Context, BluetoothProfile.ServiceListener, int) , to get the Profile Proxy. Each public profile implements this interface.

Summary

Nested Classes
interface BluetoothProfile.ServiceListener An interface for notifying BluetoothProfile IPC clients when they have been connected or disconnected to the service. 
Constants
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 Health Profile
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
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 BLUETOOTH permission.

abstract List < BluetoothDevice > getDevicesMatchingConnectionStates (int[] states)
Get a list of devices that match any of the given connection states.

Constants

public static final int A2DP

A2DP profile.

Constant Value: 2 (0x00000002)

public static final String EXTRA_PREVIOUS_STATE

Extra for the connection state intents of the individual profiles. This extra represents the previous connection state of the profile of the Bluetooth device.

Constant Value: "android.bluetooth.profile.extra.PREVIOUS_STATE"

public static final String EXTRA_STATE

Extra for the connection state intents of the individual profiles. This extra represents the current connection state of the profile of the Bluetooth device.

Constant Value: "android.bluetooth.profile.extra.STATE"

public static final int GATT

GATT

Constant Value: 7 (0x00000007)

public static final int GATT_SERVER

GATT_SERVER

Constant Value: 8 (0x00000008)

public static final int HEADSET

Headset and Handsfree profile

Constant Value: 1 (0x00000001)

public static final int HEALTH

Health Profile

Constant Value: 3 (0x00000003)

public static final int STATE_CONNECTED

The profile is in connected state

Constant Value: 2 (0x00000002)

public static final int STATE_CONNECTING

The profile is in connecting state

Constant Value: 1 (0x00000001)

public static final int STATE_DISCONNECTED

The profile is in disconnected state

Constant Value: 0 (0x00000000)

public static final int STATE_DISCONNECTING

The profile is in disconnecting state

Constant Value: 3 (0x00000003)

Public Methods

public abstract List < BluetoothDevice > getConnectedDevices ()

Get connected devices for this specific profile.

Return the set of devices which are in state STATE_CONNECTED

Requires BLUETOOTH permission.

Returns
  • List of devices. The list will be empty on error.

public abstract int getConnectionState ( BluetoothDevice device)

Get the current connection state of the profile

Requires BLUETOOTH permission.

Parameters
device Remote bluetooth device.
Returns

public abstract 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 BLUETOOTH permission.

Parameters
states Array of states. States can be one of STATE_CONNECTED , STATE_CONNECTING , STATE_DISCONNECTED , STATE_DISCONNECTING ,
Returns
  • List of devices. The list will be empty on error.