java.lang.Object | |
↳ | android.bluetooth.BluetoothA2dp |
This class provides the public APIs to control the Bluetooth A2DP profile.
BluetoothA2dp is a proxy object for controlling the Bluetooth A2DP
Service via IPC. Use getProfileProxy(Context, BluetoothProfile.ServiceListener, int)
to get
the BluetoothA2dp proxy object.
Android only supports one connected Bluetooth A2dp device at a time. Each method is protected with its appropriate permission.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | ACTION_CONNECTION_STATE_CHANGED | Intent used to broadcast the change in connection state of the A2DP profile. | |||||||||
String | ACTION_PLAYING_STATE_CHANGED | Intent used to broadcast the change in the Playing state of the A2DP profile. | |||||||||
int | STATE_NOT_PLAYING | A2DP sink device is NOT streaming music. | |||||||||
int | STATE_PLAYING | A2DP sink device is streaming music. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.bluetooth.BluetoothProfile
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Get connected devices for this specific profile.
| |||||||||||
Get the current connection state of the profile
Requires | |||||||||||
Get a list of devices that match any of the given connection
states.
| |||||||||||
Check if A2DP profile is streaming music.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
android.bluetooth.BluetoothProfile
|
Intent used to broadcast the change in connection state of the A2DP profile.
This intent will have 3 extras:
EXTRA_STATE
- The current state of the profile. EXTRA_PREVIOUS_STATE
- The previous state of the profile.EXTRA_DEVICE
- The remote device. EXTRA_STATE
or EXTRA_PREVIOUS_STATE
can be any of
STATE_DISCONNECTED
, STATE_CONNECTING
,
STATE_CONNECTED
, STATE_DISCONNECTING
.
Requires BLUETOOTH
permission to
receive.
Intent used to broadcast the change in the Playing state of the A2DP profile.
This intent will have 3 extras:
EXTRA_STATE
- The current state of the profile. EXTRA_PREVIOUS_STATE
- The previous state of the profile. EXTRA_DEVICE
- The remote device. EXTRA_STATE
or EXTRA_PREVIOUS_STATE
can be any of
STATE_PLAYING
, STATE_NOT_PLAYING
,
Requires BLUETOOTH
permission to
receive.
A2DP sink device is NOT streaming music. This state can be one of
EXTRA_STATE
or EXTRA_PREVIOUS_STATE
of
ACTION_PLAYING_STATE_CHANGED
intent.
A2DP sink device is streaming music. This state can be one of
EXTRA_STATE
or EXTRA_PREVIOUS_STATE
of
ACTION_PLAYING_STATE_CHANGED
intent.
Get connected devices for this specific profile.
Return the set of devices which are in state STATE_CONNECTED
Requires BLUETOOTH
permission.
Get the current connection state of the profile
Requires BLUETOOTH
permission.
device | Remote bluetooth device. |
---|
STATE_CONNECTED
, STATE_CONNECTING
,
STATE_DISCONNECTED
, STATE_DISCONNECTING
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.
states | Array of states. States can be one of
STATE_CONNECTED , STATE_CONNECTING ,
STATE_DISCONNECTED , STATE_DISCONNECTING , |
---|
Check if A2DP profile is streaming music.
Requires BLUETOOTH
permission.
device | BluetoothDevice device |
---|