Added in API level 11

BluetoothProfile


interface BluetoothProfile
android.bluetooth.BluetoothProfile

Public APIs for the Bluetooth Profiles.

Clients should call BluetoothAdapter#getProfileProxy, to get the Profile Proxy. Each public profile implements this interface.

Summary

Nested classes
abstract

An interface for notifying BluetoothProfile IPC clients when they have been connected or disconnected to the service.

Constants
static Int

A2DP profile.

static Int

Coordinated Set Identification Profile set coordinator

static String

Extra for the connection state intents of the individual profiles.

static String

Extra for the connection state intents of the individual profiles.

static Int

GATT

static Int

GATT_SERVER

static Int

static Int

Headset and Handsfree profile

static Int

Health Profile

static Int

Hearing Aid Device

static Int

HID Device

static Int

LE Audio Device

static Int

static Int

The profile is in connected state

static Int

The profile is in connecting state

static Int

The profile is in disconnected state

static Int

The profile is in disconnecting state

Public methods
abstract MutableList<BluetoothDevice!>!

Get connected devices for this specific profile.

abstract Int

Get the current connection state of the profile

abstract MutableList<BluetoothDevice!>!

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

Constants

A2DP

Added in API level 11
static val A2DP: Int

A2DP profile.

Value: 2

CSIP_SET_COORDINATOR

Added in API level 33
static val CSIP_SET_COORDINATOR: Int

Coordinated Set Identification Profile set coordinator

Value: 25

EXTRA_PREVIOUS_STATE

Added in API level 11
static val EXTRA_PREVIOUS_STATE: String

Extra for the connection state intents of the individual profiles.

This extra represents the previous connection state of the profile of the Bluetooth device.

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

EXTRA_STATE

Added in API level 11
static val EXTRA_STATE: String

Extra for the connection state intents of the individual profiles.

This extra represents the current connection state of the profile of the Bluetooth device.

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

GATT

Added in API level 18
static val GATT: Int

GATT

Value: 7

GATT_SERVER

Added in API level 18
static val GATT_SERVER: Int

GATT_SERVER

Value: 8

HAP_CLIENT

Added in API level 33
static val HAP_CLIENT: Int
Value: 28

HEADSET

Added in API level 11
static val HEADSET: Int

Headset and Handsfree profile

Value: 1

HEALTH

Added in API level 14
Deprecated in API level 29
static val HEALTH: Int

Deprecated: Health Device Profile (HDP) and MCAP protocol are no longer used. New apps should use Bluetooth Low Energy based solutions such as BluetoothGatt, android.bluetooth.BluetoothAdapter#listenUsingL2capChannel(), or android.bluetooth.BluetoothDevice#createL2capChannel(int)

Health Profile

Value: 3

HEARING_AID

Added in API level 29
static val HEARING_AID: Int

Hearing Aid Device

Value: 21

HID_DEVICE

Added in API level 28
static val HID_DEVICE: Int

HID Device

Value: 19

LE_AUDIO

Added in API level 33
static val LE_AUDIO: Int

LE Audio Device

Value: 22

SAP

Added in API level 23
static val SAP: Int
Value: 10

STATE_CONNECTED

Added in API level 11
static val STATE_CONNECTED: Int

The profile is in connected state

Value: 2

STATE_CONNECTING

Added in API level 11
static val STATE_CONNECTING: Int

The profile is in connecting state

Value: 1

STATE_DISCONNECTED

Added in API level 11
static val STATE_DISCONNECTED: Int

The profile is in disconnected state

Value: 0

STATE_DISCONNECTING

Added in API level 11
static val STATE_DISCONNECTING: Int

The profile is in disconnecting state

Value: 3

Public methods

getConnectedDevices

Added in API level 11
abstract fun getConnectedDevices(): MutableList<BluetoothDevice!>!

Get connected devices for this specific profile.

Return the set of devices which are in state STATE_CONNECTED

Return
MutableList<BluetoothDevice!>! List of devices. The list will be empty on error.

getConnectionState

Added in API level 11
abstract fun getConnectionState(device: BluetoothDevice!): Int

Get the current connection state of the profile

Parameters
device BluetoothDevice!: Remote bluetooth device.
Return
Int State of the profile connection. One of STATE_CONNECTED, STATE_CONNECTING, STATE_DISCONNECTED, STATE_DISCONNECTING Value is android.bluetooth.BluetoothProfile#STATE_DISCONNECTED, android.bluetooth.BluetoothProfile#STATE_CONNECTING, android.bluetooth.BluetoothProfile#STATE_CONNECTED, or android.bluetooth.BluetoothProfile#STATE_DISCONNECTING

getDevicesMatchingConnectionStates

Added in API level 11
abstract fun getDevicesMatchingConnectionStates(states: IntArray!): MutableList<BluetoothDevice!>!

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.

Parameters
states IntArray!: Array of states. States can be one of STATE_CONNECTED, STATE_CONNECTING, STATE_DISCONNECTED, STATE_DISCONNECTING,
Return
MutableList<BluetoothDevice!>! List of devices. The list will be empty on error.