AudioDeviceInfo

class AudioDeviceInfo
kotlin.Any
   ↳ android.media.AudioDeviceInfo

Class to provide information about the audio devices.
Requires API level 23 (Android 6.0, Marshmallow)

Summary

Constants
static Int

A device type describing the auxiliary line-level connectors.

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 type-agnostic device used for communication with external audio systems
Requires API level 24 (Android 7.0, Nougat)

static Int

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

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 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 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
IntArray


Requires API level 23 (Android 6.0, Marshmallow)

Int

Returns a hash code value for the object.

IntArray


Requires API level 23 (Android 6.0, Marshmallow)

Boolean
equals(other: Any?)

Indicates whether some other object is "equal to" this one.

IntArray


Requires API level 23 (Android 6.0, Marshmallow)

Int


Requires API level 23 (Android 6.0, Marshmallow)

Int


Requires API level 23 (Android 6.0, Marshmallow)

Boolean


Requires API level 23 (Android 6.0, Marshmallow)

CharSequence!


Requires API level 23 (Android 6.0, Marshmallow)

String


Requires API level 28 (Android 8.+, P)

Boolean


Requires API level 23 (Android 6.0, Marshmallow)

IntArray


Requires API level 23 (Android 6.0, Marshmallow)

IntArray


Requires API level 23 (Android 6.0, Marshmallow)

Constants

TYPE_AUX_LINE

added in API level 23
static val TYPE_AUX_LINE: Int

A device type describing the auxiliary line-level connectors.
Requires API level 23 (Android 6.0, Marshmallow)

Value: 19

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.
Requires API level 23 (Android 6.0, Marshmallow)

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.
Requires API level 23 (Android 6.0, Marshmallow)

Value: 7

TYPE_BUILTIN_EARPIECE

added in API level 23
static val TYPE_BUILTIN_EARPIECE: Int

A device type describing the attached earphone speaker.
Requires API level 23 (Android 6.0, Marshmallow)

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.
Requires API level 23 (Android 6.0, Marshmallow)

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.
Requires API level 23 (Android 6.0, Marshmallow)

Value: 2

TYPE_BUS

added in API level 24
static val TYPE_BUS: Int

A type-agnostic device used for communication with external audio systems
Requires API level 24 (Android 7.0, Nougat)

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.
Requires API level 23 (Android 6.0, Marshmallow)

Value: 13

TYPE_FM

added in API level 23
static val TYPE_FM: Int

A device type associated with the transmission of audio signals over FM.
Requires API level 23 (Android 6.0, Marshmallow)

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.
Requires API level 23 (Android 6.0, Marshmallow)

Value: 16

TYPE_HDMI

added in API level 23
static val TYPE_HDMI: Int

A device type describing an HDMI connection .
Requires API level 23 (Android 6.0, Marshmallow)

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.
Requires API level 23 (Android 6.0, Marshmallow)

Value: 10

TYPE_HEARING_AID

added in API level 28
static val TYPE_HEARING_AID: Int

A device type describing a Hearing Aid.
Requires API level 28 (Android 8.+, P)

Value: 23

TYPE_IP

added in API level 23
static val TYPE_IP: Int

A device type connected over IP.
Requires API level 23 (Android 6.0, Marshmallow)

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.
Requires API level 23 (Android 6.0, Marshmallow)

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).
Requires API level 23 (Android 6.0, Marshmallow)

Value: 6

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.
Requires API level 23 (Android 6.0, Marshmallow)

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.
Requires API level 23 (Android 6.0, Marshmallow)

Value: 17

TYPE_UNKNOWN

added in API level 23
static val TYPE_UNKNOWN: Int

A device type associated with an unknown or uninitialized device.
Requires API level 23 (Android 6.0, Marshmallow)

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.
Requires API level 23 (Android 6.0, Marshmallow)

Value: 12

TYPE_USB_DEVICE

added in API level 23
static val TYPE_USB_DEVICE: Int

A device type describing a USB audio device.
Requires API level 23 (Android 6.0, Marshmallow)

Value: 11

TYPE_USB_HEADSET

added in API level 26
static val TYPE_USB_HEADSET: Int

A device type describing a USB audio headset.
Requires API level 26 (Android 8.0, Oreo)

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.
Requires API level 23 (Android 6.0, Marshmallow)

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.
Requires API level 23 (Android 6.0, Marshmallow)

Value: 3

Public methods

getSampleRates

added in API level 23
fun getSampleRates(): IntArray


Requires API level 23 (Android 6.0, Marshmallow)

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 will never be null.

hashCode

added in API level 23
fun hashCode(): Int

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the java.lang.Object#equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java™ programming language.) Requires API level 23 (Android 6.0, Marshmallow)

Return
Int: a hash code value for this object.

getChannelIndexMasks

added in API level 23
fun getChannelIndexMasks(): IntArray


Requires API level 23 (Android 6.0, Marshmallow)

Return
IntArray: An array of channel index masks for which this audio device can be configured. This value will never be null.

See Also

equals

added in API level 23
fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true).

Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes. Requires API level 23 (Android 6.0, Marshmallow)

Parameters
obj Any?: the reference object with which to compare.
Return
Boolean: true if this object is the same as the obj argument; false otherwise.

getChannelCounts

added in API level 23
fun getChannelCounts(): IntArray


Requires API level 23 (Android 6.0, Marshmallow)

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 will never be null.

getId

added in API level 23
fun getId(): Int


Requires API level 23 (Android 6.0, Marshmallow)

Return
Int: The internal device ID.

getType

added in API level 23
fun getType(): Int


Requires API level 23 (Android 6.0, Marshmallow)

Return
Int: The device type identifier of the audio device (i.e. TYPE_BUILTIN_SPEAKER).

isSink

added in API level 23
fun isSink(): Boolean


Requires API level 23 (Android 6.0, Marshmallow)

Return
Boolean: true if the audio device is a sink for audio data (i.e. an output).

getProductName

added in API level 23
fun getProductName(): CharSequence!


Requires API level 23 (Android 6.0, Marshmallow)

Return
CharSequence!: The human-readable name of the audio device.

getAddress

added in API level 28
fun getAddress(): String


Requires API level 28 (Android 8.+, P)

Return
String: The "address" string of the device. This generally contains device-specific parameters. This value will never be null.

isSource

added in API level 23
fun isSource(): Boolean


Requires API level 23 (Android 6.0, Marshmallow)

Return
Boolean: true if the audio device is a source for audio data (e.e an input).

getChannelMasks

added in API level 23
fun getChannelMasks(): IntArray


Requires API level 23 (Android 6.0, Marshmallow)

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 will never be null.

See Also

getEncodings

added in API level 23
fun getEncodings(): IntArray


Requires API level 23 (Android 6.0, Marshmallow)

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 will never be null.

See Also