Added in API level 23

AudioDeviceInfo


class AudioDeviceInfo
kotlin.Any
   ↳ android.media.AudioDeviceInfo

Provides information about an audio device.

Summary

Constants
static Int

A device type describing the auxiliary line-level connectors.

static Int

A device type describing a Bluetooth Low Energy (BLE) broadcast group.

static Int

A device type describing a Bluetooth Low Energy (BLE) audio headset or headphones.

static Int

A device type describing a Bluetooth Low Energy (BLE) audio speaker.

static Int

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

static Int

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

static Int

A device type describing the attached earphone speaker.

static Int

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

static Int

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

static Int

A device type describing the speaker system (i.e. a mono speaker or stereo speakers) built in a device, that is specifically tuned for outputting sounds like notifications and alarms (i.e. sounds the user couldn't necessarily anticipate).

static Int

A type-agnostic device used for communication with external audio systems

static Int

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

static Int

A device type describing the audio device associated with a dock using an analog connection.

static Int

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

static Int

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

static Int

A device type describing an HDMI connection .

static Int

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

static Int

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

static Int

A device type describing a Hearing Aid.

static Int

A device type connected over IP.

static Int

A device type describing an analog line-level connection.

static Int

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

static Int

A device type for rerouting audio within the Android framework between mixes and system applications.

static Int

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

static Int

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

static Int

A device type associated with an unknown or uninitialized device.

static Int

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

static Int

A device type describing a USB audio device.

static Int

A device type describing a USB audio headset.

static Int

A device type describing a pair of wired headphones.

static Int

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

Public methods
Boolean
equals(other: Any?)

String

MutableList<AudioDescriptor!>

MutableList<AudioProfile!>

IntArray

IntArray

IntArray

IntArray

Returns an array of supported encapsulation metadata types for the device.

IntArray

Returns an array of supported encapsulation modes for the device.

IntArray

Int

CharSequence!

IntArray

Int

Int

Boolean

Boolean

Constants

TYPE_AUX_LINE

Added in API level 23
static val TYPE_AUX_LINE: Int

A device type describing the auxiliary line-level connectors.

Value: 19

TYPE_BLE_BROADCAST

Added in API level 33
static val TYPE_BLE_BROADCAST: Int

A device type describing a Bluetooth Low Energy (BLE) broadcast group.

Value: 30

TYPE_BLE_HEADSET

Added in API level 31
static val TYPE_BLE_HEADSET: Int

A device type describing a Bluetooth Low Energy (BLE) audio headset or headphones. Headphones are grouped with headsets when the device is a sink: the features of headsets and headphones with regard to playback are the same.

Value: 26

TYPE_BLE_SPEAKER

Added in API level 31
static val TYPE_BLE_SPEAKER: Int

A device type describing a Bluetooth Low Energy (BLE) audio speaker.

Value: 27

TYPE_BLUETOOTH_A2DP

Added in API level 23
static val TYPE_BLUETOOTH_A2DP: Int

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

Value: 8

TYPE_BLUETOOTH_SCO

Added in API level 23
static val TYPE_BLUETOOTH_SCO: Int

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

Value: 7

TYPE_BUILTIN_EARPIECE

Added in API level 23
static val TYPE_BUILTIN_EARPIECE: Int

A device type describing the attached earphone speaker.

Value: 1

TYPE_BUILTIN_MIC

Added in API level 23
static val TYPE_BUILTIN_MIC: Int

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

Value: 15

TYPE_BUILTIN_SPEAKER

Added in API level 23
static val TYPE_BUILTIN_SPEAKER: Int

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

Value: 2

TYPE_BUILTIN_SPEAKER_SAFE

Added in API level 30
static val TYPE_BUILTIN_SPEAKER_SAFE: Int

A device type describing the speaker system (i.e. a mono speaker or stereo speakers) built in a device, that is specifically tuned for outputting sounds like notifications and alarms (i.e. sounds the user couldn't necessarily anticipate).

Note that this physical audio device may be the same as TYPE_BUILTIN_SPEAKER but is driven differently to safely accommodate the different use case.

Value: 24

TYPE_BUS

Added in API level 24
static val TYPE_BUS: Int

A type-agnostic device used for communication with external audio systems

Value: 21

TYPE_DOCK

Added in API level 23
static val TYPE_DOCK: Int

A device type describing the audio device associated with a dock. Starting at API 34, this device type only represents digital docks, while docks with an analog connection are represented with TYPE_DOCK_ANALOG.

Value: 13

TYPE_DOCK_ANALOG

Added in API level 34
static val TYPE_DOCK_ANALOG: Int

A device type describing the audio device associated with a dock using an analog connection.

Value: 31

TYPE_FM

Added in API level 23
static val TYPE_FM: Int

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

Value: 14

TYPE_FM_TUNER

Added in API level 23
static val TYPE_FM_TUNER: Int

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

Value: 16

TYPE_HDMI

Added in API level 23
static val TYPE_HDMI: Int

A device type describing an HDMI connection .

Value: 9

TYPE_HDMI_ARC

Added in API level 23
static val TYPE_HDMI_ARC: Int

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

Value: 10

TYPE_HDMI_EARC

Added in API level 31
static val TYPE_HDMI_EARC: Int

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

Value: 29

TYPE_HEARING_AID

Added in API level 28
static val TYPE_HEARING_AID: Int

A device type describing a Hearing Aid.

Value: 23

TYPE_IP

Added in API level 23
static val TYPE_IP: Int

A device type connected over IP.

Value: 20

TYPE_LINE_ANALOG

Added in API level 23
static val TYPE_LINE_ANALOG: Int

A device type describing an analog line-level connection.

Value: 5

TYPE_LINE_DIGITAL

Added in API level 23
static val TYPE_LINE_DIGITAL: Int

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

Value: 6

TYPE_REMOTE_SUBMIX

Added in API level 31
static val TYPE_REMOTE_SUBMIX: Int

A device type for rerouting audio within the Android framework between mixes and system applications. This type is for instance encountered when querying the output device of a track (with AudioTrack#getRoutedDevice() playing from a device in screen mirroring mode, where the audio is not heard on the device, but on the remote device.

Value: 25

TYPE_TELEPHONY

Added in API level 23
static val TYPE_TELEPHONY: Int

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

Value: 18

TYPE_TV_TUNER

Added in API level 23
static val TYPE_TV_TUNER: Int

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

Value: 17

TYPE_UNKNOWN

Added in API level 23
static val TYPE_UNKNOWN: Int

A device type associated with an unknown or uninitialized device.

Value: 0

TYPE_USB_ACCESSORY

Added in API level 23
static val TYPE_USB_ACCESSORY: Int

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

Value: 12

TYPE_USB_DEVICE

Added in API level 23
static val TYPE_USB_DEVICE: Int

A device type describing a USB audio device.

Value: 11

TYPE_USB_HEADSET

Added in API level 26
static val TYPE_USB_HEADSET: Int

A device type describing a USB audio headset.

Value: 22

TYPE_WIRED_HEADPHONES

Added in API level 23
static val TYPE_WIRED_HEADPHONES: Int

A device type describing a pair of wired headphones.

Value: 4

TYPE_WIRED_HEADSET

Added in API level 23
static val TYPE_WIRED_HEADSET: Int

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

Value: 3

Public methods

equals

Added in API level 23
fun equals(other: Any?): Boolean
Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getAddress

Added in API level 28
fun getAddress(): String
Return
String The "address" string of the device. This generally contains device-specific parameters. This value cannot be null.

getAudioDescriptors

Added in API level 31
fun getAudioDescriptors(): MutableList<AudioDescriptor!>
Return
MutableList<AudioDescriptor!> A list of AudioDescriptor supported by the audio devices. This value cannot be null.

getAudioProfiles

Added in API level 31
fun getAudioProfiles(): MutableList<AudioProfile!>
Return
MutableList<AudioProfile!> A list of AudioProfile supported by the audio devices. This value cannot be null.

getChannelCounts

Added in API level 23
fun getChannelCounts(): IntArray
Return
IntArray 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. This value cannot be null.

getChannelIndexMasks

Added in API level 23
fun getChannelIndexMasks(): IntArray
Return
IntArray An array of channel index masks for which this audio device can be configured. This value cannot be null.

getChannelMasks

Added in API level 23
fun getChannelMasks(): IntArray
Return
IntArray An array of channel position masks (e.g. AudioFormat#CHANNEL_IN_STEREO, AudioFormat#CHANNEL_OUT_7POINT1) for which this audio device can be configured. This value cannot be null.

getEncapsulationMetadataTypes

Added in API level 30
fun getEncapsulationMetadataTypes(): IntArray

Returns an array of supported encapsulation metadata types for the device. The metadata type returned should be allowed for all encapsulation modes supported by the device. Some metadata types may apply only to certain compressed stream formats, the returned list is the union of subsets. The array can include any of AudioTrack#ENCAPSULATION_METADATA_TYPE_FRAMEWORK_TUNER, AudioTrack#ENCAPSULATION_METADATA_TYPE_DVB_AD_DESCRIPTOR.

Return
IntArray An array of supported encapsulation metadata types for the device. This may be an empty array if no metadata types are supported. This value cannot be null. Value is android.media.AudioTrack.ENCAPSULATION_METADATA_TYPE_NONE, android.media.AudioTrack#ENCAPSULATION_METADATA_TYPE_FRAMEWORK_TUNER, android.media.AudioTrack#ENCAPSULATION_METADATA_TYPE_DVB_AD_DESCRIPTOR, or android.media.AudioTrack#ENCAPSULATION_METADATA_TYPE_SUPPLEMENTARY_AUDIO_PLACEMENT

getEncapsulationModes

Added in API level 30
fun getEncapsulationModes(): IntArray

Returns an array of supported encapsulation modes for the device. The array can include any of the AudioTrack encapsulation modes, e.g. AudioTrack#ENCAPSULATION_MODE_ELEMENTARY_STREAM.

Return
IntArray An array of supported encapsulation modes for the device. This may be an empty array if no encapsulation modes are supported. This value cannot be null. Value is android.media.AudioTrack#ENCAPSULATION_MODE_NONE, or android.media.AudioTrack#ENCAPSULATION_MODE_ELEMENTARY_STREAM

getEncodings

Added in API level 23
fun getEncodings(): IntArray
Return
IntArray An array of audio encodings (e.g. AudioFormat#ENCODING_PCM_16BIT, AudioFormat#ENCODING_PCM_FLOAT) supported by the audio device. ENCODING_PCM_FLOAT indicates the device supports more than 16 bits of integer precision. As there is no AudioFormat constant specifically defined for 24-bit PCM, the value ENCODING_PCM_FLOAT indicates that AudioTrack or AudioRecord can preserve at least 24 bits of integer precision to that device. This value cannot be null.

getId

Added in API level 23
fun getId(): Int
Return
Int The internal device ID.

getProductName

Added in API level 23
fun getProductName(): CharSequence!
Return
CharSequence! The human-readable name of the audio device.

getSampleRates

Added in API level 23
fun getSampleRates(): IntArray
Return
IntArray An array of sample rates supported by the audio device. Note: an empty array indicates that the device supports arbitrary rates. This value cannot be null.

getType

Added in API level 23
fun getType(): Int
Return
Int The device type identifier of the audio device (i.e. TYPE_BUILTIN_SPEAKER). Value is android.media.AudioDeviceInfo#TYPE_BUILTIN_EARPIECE, android.media.AudioDeviceInfo#TYPE_BUILTIN_SPEAKER, android.media.AudioDeviceInfo#TYPE_WIRED_HEADSET, android.media.AudioDeviceInfo#TYPE_WIRED_HEADPHONES, android.media.AudioDeviceInfo#TYPE_BLUETOOTH_SCO, android.media.AudioDeviceInfo#TYPE_BLUETOOTH_A2DP, android.media.AudioDeviceInfo#TYPE_HDMI, android.media.AudioDeviceInfo#TYPE_DOCK, android.media.AudioDeviceInfo#TYPE_USB_ACCESSORY, android.media.AudioDeviceInfo#TYPE_USB_DEVICE, android.media.AudioDeviceInfo#TYPE_USB_HEADSET, android.media.AudioDeviceInfo#TYPE_TELEPHONY, android.media.AudioDeviceInfo#TYPE_LINE_ANALOG, android.media.AudioDeviceInfo#TYPE_HDMI_ARC, android.media.AudioDeviceInfo#TYPE_HDMI_EARC, android.media.AudioDeviceInfo#TYPE_LINE_DIGITAL, android.media.AudioDeviceInfo#TYPE_FM, android.media.AudioDeviceInfo#TYPE_AUX_LINE, android.media.AudioDeviceInfo#TYPE_IP, android.media.AudioDeviceInfo#TYPE_BUS, android.media.AudioDeviceInfo#TYPE_HEARING_AID, android.media.AudioDeviceInfo#TYPE_BUILTIN_MIC, android.media.AudioDeviceInfo#TYPE_FM_TUNER, android.media.AudioDeviceInfo#TYPE_TV_TUNER, android.media.AudioDeviceInfo#TYPE_BUILTIN_SPEAKER_SAFE, android.media.AudioDeviceInfo#TYPE_REMOTE_SUBMIX, android.media.AudioDeviceInfo#TYPE_BLE_HEADSET, android.media.AudioDeviceInfo#TYPE_BLE_SPEAKER, android.media.AudioDeviceInfo.TYPE_ECHO_REFERENCE, android.media.AudioDeviceInfo#TYPE_BLE_BROADCAST, or android.media.AudioDeviceInfo#TYPE_DOCK_ANALOG

hashCode

Added in API level 23
fun hashCode(): Int
Return
Int a hash code value for this object.

isSink

Added in API level 23
fun isSink(): Boolean
Return
Boolean true if the audio device is a sink for audio data (i.e. an output).

isSource

Added in API level 23
fun isSource(): Boolean
Return
Boolean true if the audio device is a source for audio data (e.e an input).