Android APIs
public final class

AudioDeviceInfo

extends Object
java.lang.Object
   ↳ android.media.AudioDeviceInfo

Class Overview

Class to provide information about the audio devices.

Summary

Constants
int TYPE_AUX_LINE A device type describing the auxiliary line-level connectors.
int TYPE_BLUETOOTH_A2DP A device type describing a Bluetooth device supporting the A2DP profile.
int TYPE_BLUETOOTH_SCO A device type describing a Bluetooth device typically used for telephony.
int TYPE_BUILTIN_EARPIECE A device type describing the attached earphone speaker.
int TYPE_BUILTIN_MIC A device type describing the microphone(s) built in a device.
int TYPE_BUILTIN_SPEAKER A device type describing the speaker system (i.e.
int TYPE_DOCK A device type describing the audio device associated with a dock.
int TYPE_FM A device type associated with the transmission of audio signals over FM.
int TYPE_FM_TUNER A device type for accessing the audio content transmitted over FM.
int TYPE_HDMI A device type describing an HDMI connection .
int TYPE_HDMI_ARC A device type describing the Audio Return Channel of an HDMI connection.
int TYPE_IP A device type connected over IP.
int TYPE_LINE_ANALOG A device type describing an analog line-level connection.
int TYPE_LINE_DIGITAL A device type describing a digital line connection (e.g.
int TYPE_TELEPHONY A device type describing the transmission of audio signals over the telephony network.
int TYPE_TV_TUNER A device type for accessing the audio content transmitted over the TV tuner system.
int TYPE_UNKNOWN A device type associated with an unknown or uninitialized device.
int TYPE_USB_ACCESSORY A device type describing a USB audio device in accessory mode.
int TYPE_USB_DEVICE A device type describing a USB audio device.
int TYPE_WIRED_HEADPHONES A device type describing a pair of wired headphones.
int TYPE_WIRED_HEADSET A device type describing a headset, which is the combination of a headphones and microphone.
Public Methods
int[] getChannelCounts()
int[] getChannelIndexMasks()
int[] getChannelMasks()
int[] getEncodings()
int getId()
CharSequence getProductName()
int[] getSampleRates()
int getType()
boolean isSink()
boolean isSource()
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int TYPE_AUX_LINE

Added in API level 23

A device type describing the auxiliary line-level connectors.

Constant Value: 19 (0x00000013)

public static final int TYPE_BLUETOOTH_A2DP

Added in API level 23

A device type describing a Bluetooth device supporting the A2DP profile.

Constant Value: 8 (0x00000008)

public static final int TYPE_BLUETOOTH_SCO

Added in API level 23

A device type describing a Bluetooth device typically used for telephony.

Constant Value: 7 (0x00000007)

public static final int TYPE_BUILTIN_EARPIECE

Added in API level 23

A device type describing the attached earphone speaker.

Constant Value: 1 (0x00000001)

public static final int TYPE_BUILTIN_MIC

Added in API level 23

A device type describing the microphone(s) built in a device.

Constant Value: 15 (0x0000000f)

public static final int TYPE_BUILTIN_SPEAKER

Added in API level 23

A device type describing the speaker system (i.e. a mono speaker or stereo speakers) built in a device.

Constant Value: 2 (0x00000002)

public static final int TYPE_DOCK

Added in API level 23

A device type describing the audio device associated with a dock.

Constant Value: 13 (0x0000000d)

public static final int TYPE_FM

Added in API level 23

A device type associated with the transmission of audio signals over FM.

Constant Value: 14 (0x0000000e)

public static final int TYPE_FM_TUNER

Added in API level 23

A device type for accessing the audio content transmitted over FM.

Constant Value: 16 (0x00000010)

public static final int TYPE_HDMI

Added in API level 23

A device type describing an HDMI connection .

Constant Value: 9 (0x00000009)

public static final int TYPE_HDMI_ARC

Added in API level 23

A device type describing the Audio Return Channel of an HDMI connection.

Constant Value: 10 (0x0000000a)

public static final int TYPE_IP

Added in API level 23

A device type connected over IP.

Constant Value: 20 (0x00000014)

public static final int TYPE_LINE_ANALOG

Added in API level 23

A device type describing an analog line-level connection.

Constant Value: 5 (0x00000005)

public static final int TYPE_LINE_DIGITAL

Added in API level 23

A device type describing a digital line connection (e.g. SPDIF).

Constant Value: 6 (0x00000006)

public static final int TYPE_TELEPHONY

Added in API level 23

A device type describing the transmission of audio signals over the telephony network.

Constant Value: 18 (0x00000012)

public static final int TYPE_TV_TUNER

Added in API level 23

A device type for accessing the audio content transmitted over the TV tuner system.

Constant Value: 17 (0x00000011)

public static final int TYPE_UNKNOWN

Added in API level 23

A device type associated with an unknown or uninitialized device.

Constant Value: 0 (0x00000000)

public static final int TYPE_USB_ACCESSORY

Added in API level 23

A device type describing a USB audio device in accessory mode.

Constant Value: 12 (0x0000000c)

public static final int TYPE_USB_DEVICE

Added in API level 23

A device type describing a USB audio device.

Constant Value: 11 (0x0000000b)

public static final int TYPE_WIRED_HEADPHONES

Added in API level 23

A device type describing a pair of wired headphones.

Constant Value: 4 (0x00000004)

public static final int TYPE_WIRED_HEADSET

Added in API level 23

A device type describing a headset, which is the combination of a headphones and microphone.

Constant Value: 3 (0x00000003)

Public Methods

public int[] getChannelCounts ()

Added in API level 23

Returns
  • An array of channel counts (1, 2, 4, ...) for which this audio device can be configured. Note: an empty array indicates that the device supports arbitrary channel counts.

public int[] getChannelIndexMasks ()

Added in API level 23

Returns
  • An array of channel index masks for which this audio device can be configured.

public int[] getChannelMasks ()

Added in API level 23

Returns

public int[] getEncodings ()

Added in API level 23

Returns
  • An array of audio encodings (e.g. ENCODING_PCM_16BIT, ENCODING_PCM_FLOAT) supported by the audio device. ENCODING_PCM_FLOAT indicates the device supports more than 16 bits of integer precision. Specifying ENCODING_PCM_FLOAT with AudioTrack or AudioRecord can preserve at least 24 bits of integer precision to that device.

public int getId ()

Added in API level 23

Returns
  • The internal device ID.

public CharSequence getProductName ()

Added in API level 23

Returns
  • The human-readable name of the audio device.

public int[] getSampleRates ()

Added in API level 23

Returns
  • An array of sample rates supported by the audio device. Note: an empty array indicates that the device supports arbitrary rates.

public int getType ()

Added in API level 23

Returns
  • The device type identifier of the audio device (i.e. TYPE_BUILTIN_SPEAKER).

public boolean isSink ()

Added in API level 23

Returns
  • true if the audio device is a sink for audio data (i.e. an output).

public boolean isSource ()

Added in API level 23

Returns
  • true if the audio device is a source for audio data (e.e an input).