Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/media/AudioManager#nestedclasses) \| [Constants](https://developer.android.com/reference/android/media/AudioManager#constants) \| [Methods](https://developer.android.com/reference/android/media/AudioManager#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/media/AudioManager#inhmethods)

# AudioManager

*** ** * ** ***


`
public


class
AudioManager
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.media.AudioManager |

<br />

*** ** * ** ***

AudioManager provides access to volume and ringer mode control.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/media/AudioManager.AudioPlaybackCallback` Interface for receiving update notifications about the playback activity on the system. |
| ` class` | `https://developer.android.com/reference/android/media/AudioManager.AudioRecordingCallback` Interface for receiving update notifications about the recording configuration. |
| ` interface` | `https://developer.android.com/reference/android/media/AudioManager.OnAudioFocusChangeListener` Interface definition for a callback to be invoked when the audio focus of the system is updated. |
| ` interface` | `https://developer.android.com/reference/android/media/AudioManager.OnCommunicationDeviceChangedListener` Listener registered by client to be notified upon communication audio device change. |
| ` interface` | `https://developer.android.com/reference/android/media/AudioManager.OnModeChangedListener` Interface definition of a callback that is notified when the audio mode changes |
| ` interface` | `https://developer.android.com/reference/android/media/AudioManager.OnPreferredMixerAttributesChangedListener` Interface to be notified of changes in the preferred mixer attributes. |

| ### Constants ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#ACTION_AUDIO_BECOMING_NOISY` Broadcast intent, a hint for applications that audio is about to become 'noisy' due to a change in audio outputs. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#ACTION_HDMI_AUDIO_PLUG` Broadcast Action: A sticky broadcast indicating an HDMI cable was plugged or unplugged. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#ACTION_HEADSET_PLUG` Broadcast Action: Wired Headset plugged in or unplugged. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#ACTION_MICROPHONE_MUTE_CHANGED` Broadcast Action: microphone muting state changed. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#ACTION_SCO_AUDIO_STATE_CHANGED` *This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/media/AudioManager#ACTION_SCO_AUDIO_STATE_UPDATED` instead* |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#ACTION_SCO_AUDIO_STATE_UPDATED` *This constant was deprecated in API level 37. Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.* |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#ACTION_SPEAKERPHONE_STATE_CHANGED` *This constant was deprecated in API level 37. Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ADJUST_LOWER` Decrease the ringer volume. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ADJUST_MUTE` Mute the volume. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ADJUST_RAISE` Increase the ringer volume. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ADJUST_SAME` Maintain the previous ringer volume. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ADJUST_TOGGLE_MUTE` Toggle the mute state. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ADJUST_UNMUTE` Unmute the volume. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_GAIN` Used to indicate a gain of audio focus, or a request of audio focus, of unknown duration. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_GAIN_TRANSIENT` Used to indicate a temporary gain or request of audio focus, anticipated to last a short amount of time. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE` Used to indicate a temporary request of audio focus, anticipated to last a short amount of time, during which no other applications, or system components, should play anything. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK` Used to indicate a temporary request of audio focus, anticipated to last a short amount of time, and where it is acceptable for other audio applications to keep playing after having lowered their output level (also referred to as "ducking"). |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_LOSS` Used to indicate a loss of audio focus of unknown duration. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_LOSS_TRANSIENT` Used to indicate a transient loss of audio focus. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK` Used to indicate a transient loss of audio focus where the loser of the audio focus can lower its output volume if it wants to continue playing (also referred to as "ducking"), as the new focus owner doesn't require others to be silent. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_NONE` Used to indicate no audio focus has been gained or lost, or requested. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_REQUEST_DELAYED` A focus change request whose granting is delayed: the request was successful, but the requester will only be granted audio focus once the condition that prevented immediate granting has ended. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_REQUEST_FAILED` A failed focus change request. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_REQUEST_GRANTED` A successful focus change request. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIO_SESSION_ID_GENERATE` A special audio session ID to indicate that the audio session ID isn't known and the framework should generate a new value. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#DIRECT_PLAYBACK_BITSTREAM_SUPPORTED` Return value for `https://developer.android.com/reference/android/media/AudioManager#getDirectPlaybackSupport(android.media.AudioFormat,%20android.media.AudioAttributes)`: direct playback supported. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#DIRECT_PLAYBACK_NOT_SUPPORTED` Return value for `https://developer.android.com/reference/android/media/AudioManager#getDirectPlaybackSupport(android.media.AudioFormat,%20android.media.AudioAttributes)`: direct playback not supported. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#DIRECT_PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED` Return value for `https://developer.android.com/reference/android/media/AudioManager#getDirectPlaybackSupport(android.media.AudioFormat,%20android.media.AudioAttributes)`: direct offload playback supported with gapless transitions. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#DIRECT_PLAYBACK_OFFLOAD_SUPPORTED` Return value for `https://developer.android.com/reference/android/media/AudioManager#getDirectPlaybackSupport(android.media.AudioFormat,%20android.media.AudioAttributes)`: direct offload playback supported. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ENCODED_SURROUND_OUTPUT_ALWAYS` The surround sound formats are ALWAYS available, even if they are not detected by the hardware. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ENCODED_SURROUND_OUTPUT_AUTO` The surround sound formats are available for use if they are detected. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ENCODED_SURROUND_OUTPUT_MANUAL` Surround sound formats are available according to the choice of user, even if they are not detected by the hardware. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ENCODED_SURROUND_OUTPUT_NEVER` The surround sound formats are NEVER available, even if they are detected by the hardware. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ENCODED_SURROUND_OUTPUT_UNKNOWN` The mode for surround sound formats is unknown. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ERROR` A default error code. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ERROR_DEAD_OBJECT` An error code indicating that the object reporting it is no longer valid and needs to be recreated. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#EXTRA_AUDIO_PLUG_STATE` Extra used in `https://developer.android.com/reference/android/media/AudioManager#ACTION_HDMI_AUDIO_PLUG` to communicate whether HDMI is plugged in or unplugged. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#EXTRA_ENCODINGS` Extra used in `https://developer.android.com/reference/android/media/AudioManager#ACTION_HDMI_AUDIO_PLUG` to define the audio encodings supported by the connected HDMI device. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#EXTRA_MAX_CHANNEL_COUNT` Extra used in `https://developer.android.com/reference/android/media/AudioManager#ACTION_HDMI_AUDIO_PLUG` to define the maximum number of channels supported by the HDMI device. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#EXTRA_RINGER_MODE` The new ringer mode. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#EXTRA_SCO_AUDIO_PREVIOUS_STATE` *This constant was deprecated in API level 37. Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.* |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#EXTRA_SCO_AUDIO_STATE` *This constant was deprecated in API level 37. Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.* |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#EXTRA_VIBRATE_SETTING` *This constant was deprecated in API level 16. Applications should maintain their own vibrate policy based on current ringer mode and listen to `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_CHANGED_ACTION` instead.* |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#EXTRA_VIBRATE_TYPE` *This constant was deprecated in API level 16. Applications should maintain their own vibrate policy based on current ringer mode and listen to `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_CHANGED_ACTION` instead.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FLAG_ALLOW_RINGER_MODES` Whether to include ringer modes as possible options when changing volume. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FLAG_PLAY_SOUND` Whether to play a sound when changing the volume. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FLAG_REMOVE_SOUND_AND_VIBRATE` Removes any sounds/vibrate that may be in the queue, or are playing (related to changing volume). |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FLAG_SHOW_UI` Show a toast containing the current volume. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FLAG_VIBRATE` Whether to vibrate if going into the vibrate ringer mode. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FX_BACK` Back sound |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FX_FOCUS_NAVIGATION_DOWN` Focus has moved down |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FX_FOCUS_NAVIGATION_LEFT` Focus has moved left |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FX_FOCUS_NAVIGATION_RIGHT` Focus has moved right |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FX_FOCUS_NAVIGATION_UP` Focus has moved up |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FX_KEYPRESS_DELETE` IME delete keypress sound |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FX_KEYPRESS_INVALID` Invalid keypress sound |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FX_KEYPRESS_RETURN` IME return_keypress sound |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FX_KEYPRESS_SPACEBAR` IME spacebar keypress sound |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FX_KEYPRESS_STANDARD` IME standard keypress sound |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#FX_KEY_CLICK` Keyboard and direction pad click sound |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#GET_DEVICES_ALL` Specifies to the `https://developer.android.com/reference/android/media/AudioManager#getDevices(int)` method to include both source and sink devices. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#GET_DEVICES_INPUTS` Specifies to the `https://developer.android.com/reference/android/media/AudioManager#getDevices(int)` method to include source (i.e. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#GET_DEVICES_OUTPUTS` Specifies to the `https://developer.android.com/reference/android/media/AudioManager#getDevices(int)` method to include sink (i.e. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#MODE_ASSISTANT_CONVERSATION` Use this mode whenever an assistant conversation mode is started. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#MODE_CALL_REDIRECT` A telephony call is established and its audio is being redirected to another device. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#MODE_CALL_SCREENING` Call screening in progress. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#MODE_COMMUNICATION_REDIRECT` An audio/video chat or VoIP call is established and its audio is being redirected to another device. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#MODE_CURRENT` Current audio mode. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#MODE_INVALID` Invalid audio mode. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#MODE_IN_CALL` In call audio mode. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#MODE_IN_COMMUNICATION` In communication audio mode. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#MODE_NORMAL` Normal audio mode: not ringing and no call established. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#MODE_RINGTONE` Ringing audio mode. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#NUM_STREAMS` *This constant was deprecated in API level 15. Do not iterate on volume stream type values.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED` Return value for `https://developer.android.com/reference/android/media/AudioManager#getPlaybackOffloadSupport(android.media.AudioFormat,%20android.media.AudioAttributes)`: offload playback supported with gapless transitions |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#PLAYBACK_OFFLOAD_NOT_SUPPORTED` Return value for `https://developer.android.com/reference/android/media/AudioManager#getPlaybackOffloadSupport(android.media.AudioFormat,%20android.media.AudioAttributes)`: offload playback not supported |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#PLAYBACK_OFFLOAD_SUPPORTED` Return value for `https://developer.android.com/reference/android/media/AudioManager#getPlaybackOffloadSupport(android.media.AudioFormat,%20android.media.AudioAttributes)`: offload playback supported |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#PROPERTY_OUTPUT_FRAMES_PER_BUFFER` Used as a key for `https://developer.android.com/reference/android/media/AudioManager#getProperty(java.lang.String)` to request the native or optimal output buffer size for this device's low latency output stream, in decimal PCM frames. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#PROPERTY_OUTPUT_SAMPLE_RATE` Used as a key for `https://developer.android.com/reference/android/media/AudioManager#getProperty(java.lang.String)` to request the native or optimal output sample rate for this device's low latency output stream, in decimal Hz. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#PROPERTY_SUPPORT_AUDIO_SOURCE_UNPROCESSED` Used as a key for `https://developer.android.com/reference/android/media/AudioManager#getProperty(java.lang.String)` to determine if the unprocessed audio source is available and supported with the expected frequency range and level response. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#PROPERTY_SUPPORT_MIC_NEAR_ULTRASOUND` Used as a key for `https://developer.android.com/reference/android/media/AudioManager#getProperty(java.lang.String)` to determine if the default microphone audio source supports near-ultrasound frequencies (range of 18 - 21 kHz). |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#PROPERTY_SUPPORT_SPEAKER_NEAR_ULTRASOUND` Used as a key for `https://developer.android.com/reference/android/media/AudioManager#getProperty(java.lang.String)` to determine if the default speaker audio path supports near-ultrasound frequencies (range of 18 - 21 kHz). |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_CHANGED_ACTION` Sticky broadcast intent action indicating that the ringer mode has changed. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_NORMAL` Ringer mode that may be audible and may vibrate. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_SILENT` Ringer mode that will be silent and will not vibrate. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_VIBRATE` Ringer mode that will be silent and will vibrate. |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ROUTE_ALL` *This constant was deprecated in API level 15. Do not set audio routing directly, use setSpeakerphoneOn(), setBluetoothScoOn() methods instead.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ROUTE_BLUETOOTH` *This constant was deprecated in API level 15. use `https://developer.android.com/reference/android/media/AudioManager#ROUTE_BLUETOOTH_SCO`Do not set audio routing directly, use setSpeakerphoneOn(), setBluetoothScoOn() methods instead.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ROUTE_BLUETOOTH_A2DP` *This constant was deprecated in API level 15. Do not set audio routing directly, use setSpeakerphoneOn(), setBluetoothScoOn() methods instead.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ROUTE_BLUETOOTH_SCO` *This constant was deprecated in API level 15. Do not set audio routing directly, use setSpeakerphoneOn(), setBluetoothScoOn() methods instead.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ROUTE_EARPIECE` *This constant was deprecated in API level 15. Do not set audio routing directly, use setSpeakerphoneOn(), setBluetoothScoOn() methods instead.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ROUTE_HEADSET` *This constant was deprecated in API level 15. Do not set audio routing directly, use setSpeakerphoneOn(), setBluetoothScoOn() methods instead.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#ROUTE_SPEAKER` *This constant was deprecated in API level 15. Do not set audio routing directly, use setSpeakerphoneOn(), setBluetoothScoOn() methods instead.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#SCO_AUDIO_STATE_CONNECTED` *This constant was deprecated in API level 37. Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#SCO_AUDIO_STATE_CONNECTING` *This constant was deprecated in API level 37. Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#SCO_AUDIO_STATE_DISCONNECTED` *This constant was deprecated in API level 37. Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#SCO_AUDIO_STATE_ERROR` *This constant was deprecated in API level 37. Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#STREAM_ACCESSIBILITY` Used to identify the volume of audio streams for accessibility prompts |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#STREAM_ALARM` Used to identify the volume of audio streams for alarms |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#STREAM_ASSISTANT` Used to identify the volume of audio streams for virtual assistant |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#STREAM_DTMF` Used to identify the volume of audio streams for DTMF Tones |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#STREAM_MUSIC` Used to identify the volume of audio streams for music playback |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#STREAM_NOTIFICATION` Used to identify the volume of audio streams for notifications |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#STREAM_RING` Used to identify the volume of audio streams for the phone ring |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#STREAM_SYSTEM` Used to identify the volume of audio streams for system sounds |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#STREAM_VOICE_CALL` Used to identify the volume of audio streams for phone calls |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#USE_DEFAULT_STREAM_TYPE` Suggests using the default stream type. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_SETTING_CHANGED_ACTION` *This constant was deprecated in API level 16. Applications should maintain their own vibrate policy based on current ringer mode and listen to `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_CHANGED_ACTION` instead.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_SETTING_OFF` *This constant was deprecated in API level 16. Applications should maintain their own vibrate policy based on current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_SETTING_ON` *This constant was deprecated in API level 16. Applications should maintain their own vibrate policy based on current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_SETTING_ONLY_SILENT` *This constant was deprecated in API level 16. Applications should maintain their own vibrate policy based on current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_TYPE_NOTIFICATION` *This constant was deprecated in API level 16. Applications should maintain their own vibrate policy based on current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.* |
| `int` | `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_TYPE_RINGER` *This constant was deprecated in API level 16. Applications should maintain their own vibrate policy based on current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.* |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#abandonAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener)(https://developer.android.com/reference/android/media/AudioManager.OnAudioFocusChangeListener l) ` *This method was deprecated in API level 26. use `https://developer.android.com/reference/android/media/AudioManager#abandonAudioFocusRequest(android.media.AudioFocusRequest)`* |
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#abandonAudioFocusRequest(android.media.AudioFocusRequest)(https://developer.android.com/reference/android/media/AudioFocusRequest focusRequest) ` Abandon audio focus. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/media/AudioManager.OnCommunicationDeviceChangedListener listener) ` Adds a listener for being notified of changes to the communication audio device. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#addOnModeChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnModeChangedListener)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/media/AudioManager.OnModeChangedListener listener) ` Adds a listener to be notified of changes to the audio mode. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#addOnPreferredMixerAttributesChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnPreferredMixerAttributesChangedListener)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/media/AudioManager.OnPreferredMixerAttributesChangedListener listener) ` Adds a listener for being notified of changes to the preferred mixer attributes. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)(int streamType, int direction, int flags) ` Adjusts the volume of a particular stream by one step in a direction. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#adjustSuggestedStreamVolume(int,%20int,%20int)(int direction, int suggestedStreamType, int flags) ` Adjusts the volume of the most relevant stream, or the given fallback stream. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#adjustVolume(int,%20int)(int direction, int flags) ` Adjusts the volume of the most relevant stream. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#adjustVolumeGroupVolume(int,%20int,%20int)(int groupId, int direction, int flags) ` Adjusts the volume of a particular group associated to given id by one step in a direction. |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#canManageAssistantAudio()() ` Checks if the calling app can manage assistant audio. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#clearCommunicationDevice()() ` Cancels previous communication device selection made with `https://developer.android.com/reference/android/media/AudioManager#setCommunicationDevice(android.media.AudioDeviceInfo)`. |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#clearPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo)(https://developer.android.com/reference/android/media/AudioAttributes attributes, https://developer.android.com/reference/android/media/AudioDeviceInfo device) ` Clears the current preferred mixer attributes that were previously set via `https://developer.android.com/reference/android/media/AudioManager#setPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo,%20android.media.AudioMixerAttributes)` Requires `https://developer.android.com/reference/android/Manifest.permission#MODIFY_AUDIO_SETTINGS` |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#dispatchMediaKeyEvent(android.view.KeyEvent)(https://developer.android.com/reference/android/view/KeyEvent keyEvent) ` Sends a simulated key event for a media button. |
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#generateAudioSessionId()() ` Return a new audio session identifier not associated with any player or effect. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/AudioPlaybackConfiguration>` | ` https://developer.android.com/reference/android/media/AudioManager#getActivePlaybackConfigurations()() ` Returns the current active audio playback configurations of the device |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/AudioRecordingConfiguration>` | ` https://developer.android.com/reference/android/media/AudioManager#getActiveRecordingConfigurations()() ` Returns the current active audio recording configurations of the device. |
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#getAllowedCapturePolicy()() ` Return the capture policy. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/AudioDeviceInfo>` | ` https://developer.android.com/reference/android/media/AudioManager#getAudioDevicesForAttributes(android.media.AudioAttributes)(https://developer.android.com/reference/android/media/AudioAttributes attributes) ` Get the audio devices that would be used for the routing of the given audio attributes. |
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#getAudioHwSyncForSession(int)(int sessionId) ` Retrieves the Hardware A/V synchronization ID corresponding to the given audio session ID. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/AudioDeviceInfo>` | ` https://developer.android.com/reference/android/media/AudioManager#getAvailableCommunicationDevices()() ` Returns a list of audio devices that can be selected for communication use cases via `https://developer.android.com/reference/android/media/AudioManager#setCommunicationDevice(android.media.AudioDeviceInfo)`. |
| ` https://developer.android.com/reference/android/media/AudioDeviceInfo` | ` https://developer.android.com/reference/android/media/AudioManager#getCommunicationDevice()() ` Returns currently selected audio device for communication. |
| ` https://developer.android.com/reference/android/media/AudioDeviceInfo` | ` https://developer.android.com/reference/android/media/AudioManager#getDevices(int)(int flags) ` Returns an array of `https://developer.android.com/reference/android/media/AudioDeviceInfo` objects corresponding to the audio devices currently connected to the system and meeting the criteria specified in the `flags` parameter. |
| ` static int` | ` https://developer.android.com/reference/android/media/AudioManager#getDirectPlaybackSupport(android.media.AudioFormat,%20android.media.AudioAttributes)(https://developer.android.com/reference/android/media/AudioFormat format, https://developer.android.com/reference/android/media/AudioAttributes attributes) ` Returns a bitfield representing the different forms of direct playback currently available for a given audio format. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/AudioProfile>` | ` https://developer.android.com/reference/android/media/AudioManager#getDirectProfilesForAttributes(android.media.AudioAttributes)(https://developer.android.com/reference/android/media/AudioAttributes attributes) ` Returns a list of direct `https://developer.android.com/reference/android/media/AudioProfile` that are supported for the specified `https://developer.android.com/reference/android/media/AudioAttributes`. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/AudioProfile>` | ` https://developer.android.com/reference/android/media/AudioManager#getDirectProfilesForAttributes(android.media.AudioAttributes,%20int)(https://developer.android.com/reference/android/media/AudioAttributes attributes, int uid) ` Returns a list of direct `https://developer.android.com/reference/android/media/AudioProfile` that are supported for the specified `https://developer.android.com/reference/android/media/AudioAttributes`. |
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#getEncodedSurroundMode()() ` Gets the surround sound mode. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/MicrophoneInfo>` | ` https://developer.android.com/reference/android/media/AudioManager#getMicrophones()() ` Returns a list of `https://developer.android.com/reference/android/media/MicrophoneInfo` that corresponds to the characteristics of all available microphones. |
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#getMode()() ` Returns the current audio mode. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/media/AudioManager#getParameters(java.lang.String)(https://developer.android.com/reference/java/lang/String keys) ` Gets a variable number of parameter values from audio hardware. |
| ` static int` | ` https://developer.android.com/reference/android/media/AudioManager#getPlaybackOffloadSupport(android.media.AudioFormat,%20android.media.AudioAttributes)(https://developer.android.com/reference/android/media/AudioFormat format, https://developer.android.com/reference/android/media/AudioAttributes attributes) ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/media/AudioManager#getDirectPlaybackSupport(android.media.AudioFormat,%20android.media.AudioAttributes)` instead* |
| ` https://developer.android.com/reference/android/media/AudioMixerAttributes` | ` https://developer.android.com/reference/android/media/AudioManager#getPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo)(https://developer.android.com/reference/android/media/AudioAttributes attributes, https://developer.android.com/reference/android/media/AudioDeviceInfo device) ` Returns current preferred mixer attributes that is set via `https://developer.android.com/reference/android/media/AudioManager#setPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo,%20android.media.AudioMixerAttributes)` |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/media/AudioManager#getProperty(java.lang.String)(https://developer.android.com/reference/java/lang/String key) ` Returns the value of the property with the specified key. |
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#getRingerMode()() ` Returns the current ringtone mode. |
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#getRouting(int)(int mode) ` *This method was deprecated in API level 15. Do not query audio routing directly, use isSpeakerphoneOn(), isBluetoothScoOn(), isBluetoothA2dpOn() and isWiredHeadsetOn() methods instead.* |
| ` https://developer.android.com/reference/android/media/Spatializer` | ` https://developer.android.com/reference/android/media/AudioManager#getSpatializer()() ` Return a handle to the optional platform's `https://developer.android.com/reference/android/media/Spatializer` |
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#getStreamMaxVolume(int)(int streamType) ` Returns the maximum volume index for a particular stream. |
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#getStreamMinVolume(int)(int streamType) ` Returns the minimum volume index for a particular stream. |
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#getStreamVolume(int)(int streamType) ` Returns the current volume index for a particular stream. |
| ` float` | ` https://developer.android.com/reference/android/media/AudioManager#getStreamVolumeDb(int,%20int,%20int)(int streamType, int index, int deviceType) ` Returns the volume in dB (decibel) for the given stream type at the given volume index, on the given type of audio output device. |
| ` https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/lang/Integer>` | ` https://developer.android.com/reference/android/media/AudioManager#getSupportedDeviceTypes(int)(int direction) ` Returns a Set of unique Integers corresponding to audio device type identifiers that can *potentially* be connected to the system and meeting the criteria specified in the `direction` parameter. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/AudioMixerAttributes>` | ` https://developer.android.com/reference/android/media/AudioManager#getSupportedMixerAttributes(android.media.AudioDeviceInfo)(https://developer.android.com/reference/android/media/AudioDeviceInfo device) ` Returns the `https://developer.android.com/reference/android/media/AudioMixerAttributes` that can be used to set as preferred mixer attributes via `https://developer.android.com/reference/android/media/AudioManager#setPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo,%20android.media.AudioMixerAttributes)`. |
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#getVibrateSetting(int)(int vibrateType) ` *This method was deprecated in API level 16. Applications should maintain their own vibrate policy based on current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.* |
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#getVolumeGroupIdForAttributes(android.media.AudioAttributes)(https://developer.android.com/reference/android/media/AudioAttributes attributes) ` Returns the volume group id associated to the given `https://developer.android.com/reference/android/media/AudioAttributes`. |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#isBluetoothA2dpOn()() ` *This method was deprecated in API level 26. Use `https://developer.android.com/reference/android/media/AudioManager#getDevices(int)` instead to list available audio devices.* |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#isBluetoothScoAvailableOffCall()() ` *This method was deprecated in API level 37. This method is no longer necessary, the framework always supports SCO off call* |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#isBluetoothScoOn()() ` *This method was deprecated in API level 34. Use `https://developer.android.com/reference/android/media/AudioManager#getCommunicationDevice()` instead.* |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#isCallScreeningModeSupported()() ` Indicates if the platform supports a special call screening and call monitoring mode. |
| ` static boolean` | ` https://developer.android.com/reference/android/media/AudioManager#isHapticPlaybackSupported()() ` Return if audio haptic coupled playback is supported or not. |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#isMicrophoneMute()() ` Checks whether the microphone mute is on or off. |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#isMusicActive()() ` Checks whether any music is active. |
| ` static boolean` | ` https://developer.android.com/reference/android/media/AudioManager#isOffloadedPlaybackSupported(android.media.AudioFormat,%20android.media.AudioAttributes)(https://developer.android.com/reference/android/media/AudioFormat format, https://developer.android.com/reference/android/media/AudioAttributes attributes) ` Returns whether offloaded playback of an audio format is supported on the device. |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#isRampingRingerEnabled()() ` Returns the current user setting for ramping ringer on incoming phone call ringtone. |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#isSpeakerphoneOn()() ` *This method was deprecated in API level 34. Use `https://developer.android.com/reference/android/media/AudioManager#getCommunicationDevice()` instead.* |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#isStreamMute(int)(int streamType) ` Returns the current mute state for a particular stream. |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#isSurroundFormatEnabled(int)(int audioFormat) ` Gets whether a certain surround format is enabled or not. |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#isVolumeFixed()() ` Indicates if the device implements a fixed volume policy. |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#isVolumeGroupMuted(int)(int groupId) ` Returns the current mute state for a particular volume group associated to the given id. |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#isWiredHeadsetOn()() ` *This method was deprecated in API level 15. Use `https://developer.android.com/reference/android/media/AudioManager#getDevices(int)` instead to list available audio devices.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#loadSoundEffects()() ` Load Sound effects. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#playSoundEffect(int)(int effectType) ` Plays a sound effect (Key clicks, lid open/close...) |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#playSoundEffect(int,%20float)(int effectType, float volume) ` Plays a sound effect (Key clicks, lid open/close...) |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#registerAudioDeviceCallback(android.media.AudioDeviceCallback,%20android.os.Handler)(https://developer.android.com/reference/android/media/AudioDeviceCallback callback, https://developer.android.com/reference/android/os/Handler handler) ` Registers an `https://developer.android.com/reference/android/media/AudioDeviceCallback` object to receive notifications of changes to the set of connected audio devices. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#registerAudioPlaybackCallback(android.media.AudioManager.AudioPlaybackCallback,%20android.os.Handler)(https://developer.android.com/reference/android/media/AudioManager.AudioPlaybackCallback cb, https://developer.android.com/reference/android/os/Handler handler) ` Register a callback to be notified of audio playback changes through `https://developer.android.com/reference/android/media/AudioManager.AudioPlaybackCallback` |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#registerAudioRecordingCallback(android.media.AudioManager.AudioRecordingCallback,%20android.os.Handler)(https://developer.android.com/reference/android/media/AudioManager.AudioRecordingCallback cb, https://developer.android.com/reference/android/os/Handler handler) ` Register a callback to be notified of audio recording changes through `https://developer.android.com/reference/android/media/AudioManager.AudioRecordingCallback` |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#registerMediaButtonEventReceiver(android.content.ComponentName)(https://developer.android.com/reference/android/content/ComponentName eventReceiver) ` *This method was deprecated in API level 21. Use `https://developer.android.com/reference/android/media/session/MediaSession#setMediaButtonReceiver(android.app.PendingIntent)` instead.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#registerMediaButtonEventReceiver(android.app.PendingIntent)(https://developer.android.com/reference/android/app/PendingIntent eventReceiver) ` *This method was deprecated in API level 21. Use `https://developer.android.com/reference/android/media/session/MediaSession#setMediaButtonReceiver(android.app.PendingIntent)` instead.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#registerRemoteControlClient(android.media.RemoteControlClient)(https://developer.android.com/reference/android/media/RemoteControlClient rcClient) ` *This method was deprecated in API level 21. Use `https://developer.android.com/reference/android/media/session/MediaSession` instead.* |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#registerRemoteController(android.media.RemoteController)(https://developer.android.com/reference/android/media/RemoteController rctlr) ` *This method was deprecated in API level 21. Use `https://developer.android.com/reference/android/media/session/MediaSessionManager#addOnActiveSessionsChangedListener(android.media.session.MediaSessionManager.OnActiveSessionsChangedListener,%20android.content.ComponentName)` and `https://developer.android.com/reference/android/media/session/MediaController` instead.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#removeOnCommunicationDeviceChangedListener(android.media.AudioManager.OnCommunicationDeviceChangedListener)(https://developer.android.com/reference/android/media/AudioManager.OnCommunicationDeviceChangedListener listener) ` Removes a previously added listener of changes to the communication audio device. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#removeOnModeChangedListener(android.media.AudioManager.OnModeChangedListener)(https://developer.android.com/reference/android/media/AudioManager.OnModeChangedListener listener) ` Removes a previously added listener for changes to audio mode. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#removeOnPreferredMixerAttributesChangedListener(android.media.AudioManager.OnPreferredMixerAttributesChangedListener)(https://developer.android.com/reference/android/media/AudioManager.OnPreferredMixerAttributesChangedListener listener) ` Removes a previously added listener of changes to the preferred mixer attributes. |
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#requestAudioFocus(android.media.AudioFocusRequest)(https://developer.android.com/reference/android/media/AudioFocusRequest focusRequest) ` Request audio focus. |
| ` int` | ` https://developer.android.com/reference/android/media/AudioManager#requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener,%20int,%20int)(https://developer.android.com/reference/android/media/AudioManager.OnAudioFocusChangeListener l, int streamType, int durationHint) ` *This method was deprecated in API level 26. use `https://developer.android.com/reference/android/media/AudioManager#requestAudioFocus(android.media.AudioFocusRequest)`* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#setAllowedCapturePolicy(int)(int capturePolicy) ` Specifies whether the audio played by this app may or may not be captured by other apps or the system. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#setBluetoothA2dpOn(boolean)(boolean on) ` *This method was deprecated in API level 15. Use `https://developer.android.com/reference/android/media/MediaRouter#selectRoute(int,%20android.media.MediaRouter.RouteInfo)` instead.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#setBluetoothScoOn(boolean)(boolean on) ` *This method was deprecated in API level 37. Use `https://developer.android.com/` instead.* |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#setCommunicationDevice(android.media.AudioDeviceInfo)(https://developer.android.com/reference/android/media/AudioDeviceInfo device) ` Selects the audio device that should be used for communication use cases, for instance voice or video calls. |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#setEncodedSurroundMode(int)(int mode) ` Sets the surround sound mode. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#setMicrophoneMute(boolean)(boolean on) ` Sets the microphone mute on or off. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#setMode(int)(int mode) ` Sets the audio mode. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#setParameters(java.lang.String)(https://developer.android.com/reference/java/lang/String keyValuePairs) ` Sets a variable number of parameter values to audio hardware. |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#setPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo,%20android.media.AudioMixerAttributes)(https://developer.android.com/reference/android/media/AudioAttributes attributes, https://developer.android.com/reference/android/media/AudioDeviceInfo device, https://developer.android.com/reference/android/media/AudioMixerAttributes mixerAttributes) ` Configures the mixer attributes for a particular `https://developer.android.com/reference/android/media/AudioAttributes` over a given `https://developer.android.com/reference/android/media/AudioDeviceInfo`. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#setRingerMode(int)(int ringerMode) ` Sets the ringer mode. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#setRouting(int,%20int,%20int)(int mode, int routes, int mask) ` *This method was deprecated in API level 15. Do not set audio routing directly, use setSpeakerphoneOn(), setBluetoothScoOn() methods instead.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#setSpeakerphoneOn(boolean)(boolean on) ` *This method was deprecated in API level 34. Use `https://developer.android.com/reference/android/media/AudioManager#setCommunicationDevice(android.media.AudioDeviceInfo)` or `https://developer.android.com/reference/android/media/AudioManager#clearCommunicationDevice()` instead.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#setStreamMute(int,%20boolean)(int streamType, boolean state) ` *This method was deprecated in API level 23. Use `https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)` with `https://developer.android.com/reference/android/media/AudioManager#ADJUST_MUTE` or `https://developer.android.com/reference/android/media/AudioManager#ADJUST_UNMUTE` instead.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#setStreamSolo(int,%20boolean)(int streamType, boolean state) ` *This method was deprecated in API level 23. Do not use. If you need exclusive audio playback use `https://developer.android.com/reference/android/media/AudioManager#requestAudioFocus(android.media.AudioFocusRequest)`.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#setStreamVolume(int,%20int,%20int)(int streamType, int index, int flags) ` Sets the volume index for a particular stream. |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#setSurroundFormatEnabled(int,%20boolean)(int audioFormat, boolean enabled) ` Sets and persists a certain surround format as enabled or not. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#setVibrateSetting(int,%20int)(int vibrateType, int vibrateSetting) ` *This method was deprecated in API level 16. Applications should maintain their own vibrate policy based on current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#setWiredHeadsetOn(boolean)(boolean on) ` *This method was deprecated in API level 15. Do not use.* |
| ` boolean` | ` https://developer.android.com/reference/android/media/AudioManager#shouldVibrate(int)(int vibrateType) ` *This method was deprecated in API level 16. Applications should maintain their own vibrate policy based on current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#startBluetoothSco()() ` *This method was deprecated in API level 34. Use `https://developer.android.com/reference/android/media/AudioManager#setCommunicationDevice(android.media.AudioDeviceInfo)` instead.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#stopBluetoothSco()() ` *This method was deprecated in API level 34. Use `https://developer.android.com/reference/android/media/AudioManager#clearCommunicationDevice()` instead.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#unloadSoundEffects()() ` Unload Sound effects. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#unregisterAudioDeviceCallback(android.media.AudioDeviceCallback)(https://developer.android.com/reference/android/media/AudioDeviceCallback callback) ` Unregisters an `https://developer.android.com/reference/android/media/AudioDeviceCallback` object which has been previously registered to receive notifications of changes to the set of connected audio devices. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#unregisterAudioPlaybackCallback(android.media.AudioManager.AudioPlaybackCallback)(https://developer.android.com/reference/android/media/AudioManager.AudioPlaybackCallback cb) ` Unregister an audio playback callback previously registered with `https://developer.android.com/reference/android/media/AudioManager#registerAudioPlaybackCallback(android.media.AudioManager.AudioPlaybackCallback,%20android.os.Handler)`. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#unregisterAudioRecordingCallback(android.media.AudioManager.AudioRecordingCallback)(https://developer.android.com/reference/android/media/AudioManager.AudioRecordingCallback cb) ` Unregister an audio recording callback previously registered with `https://developer.android.com/reference/android/media/AudioManager#registerAudioRecordingCallback(android.media.AudioManager.AudioRecordingCallback,%20android.os.Handler)`. |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#unregisterMediaButtonEventReceiver(android.content.ComponentName)(https://developer.android.com/reference/android/content/ComponentName eventReceiver) ` *This method was deprecated in API level 21. Use `https://developer.android.com/reference/android/media/session/MediaSession` instead.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#unregisterMediaButtonEventReceiver(android.app.PendingIntent)(https://developer.android.com/reference/android/app/PendingIntent eventReceiver) ` *This method was deprecated in API level 21. Use `https://developer.android.com/reference/android/media/session/MediaSession` instead.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#unregisterRemoteControlClient(android.media.RemoteControlClient)(https://developer.android.com/reference/android/media/RemoteControlClient rcClient) ` *This method was deprecated in API level 21. Use `https://developer.android.com/reference/android/media/session/MediaSession` instead.* |
| ` void` | ` https://developer.android.com/reference/android/media/AudioManager#unregisterRemoteController(android.media.RemoteController)(https://developer.android.com/reference/android/media/RemoteController rctlr) ` *This method was deprecated in API level 21. Use `https://developer.android.com/reference/android/media/session/MediaSessionManager#removeOnActiveSessionsChangedListener(android.media.session.MediaSessionManager.OnActiveSessionsChangedListener)` instead.* |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

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


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


## Constants

### ACTION_AUDIO_BECOMING_NOISY

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String ACTION_AUDIO_BECOMING_NOISY
```

Broadcast intent, a hint for applications that audio is about to become
'noisy' due to a change in audio outputs. For example, this intent may
be sent when a wired headset is unplugged, or when an A2DP audio
sink is disconnected, and the audio system is about to automatically
switch audio route to the speaker. Applications that are controlling
audio streams may consider pausing, reducing volume or some other action
on receipt of this intent so as not to surprise the user with audio
from the speaker.

<br />

Constant Value:

"android.media.AUDIO_BECOMING_NOISY"


### ACTION_HDMI_AUDIO_PLUG

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String ACTION_HDMI_AUDIO_PLUG
```

Broadcast Action: A sticky broadcast indicating an HDMI cable was plugged or unplugged.

The intent will have the following extra values: `https://developer.android.com/reference/android/media/AudioManager#EXTRA_AUDIO_PLUG_STATE`,
`https://developer.android.com/reference/android/media/AudioManager#EXTRA_MAX_CHANNEL_COUNT`, `https://developer.android.com/reference/android/media/AudioManager#EXTRA_ENCODINGS`.

It can only be received by explicitly registering for it with
`https://developer.android.com/reference/android/content/Context#registerReceiver(android.content.BroadcastReceiver,%20android.content.IntentFilter)`.

<br />

Constant Value:

"android.media.action.HDMI_AUDIO_PLUG"


### ACTION_HEADSET_PLUG

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String ACTION_HEADSET_PLUG
```

Broadcast Action: Wired Headset plugged in or unplugged.

You *cannot* receive this through components declared
in manifests, only by explicitly registering for it with
`https://developer.android.com/reference/android/content/Context#registerReceiver(android.content.BroadcastReceiver,%20android.content.IntentFilter)`.

The intent will have the following extra values:

- *state* - 0 for unplugged, 1 for plugged.
- *name* - Headset type, human readable string
- *microphone* - 1 if headset has a microphone, 0 otherwise

<br />

<br />

Constant Value:

"android.intent.action.HEADSET_PLUG"


### ACTION_MICROPHONE_MUTE_CHANGED

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String ACTION_MICROPHONE_MUTE_CHANGED
```

Broadcast Action: microphone muting state changed.

You *cannot* receive this through components declared
in manifests, only by explicitly registering for it with
`https://developer.android.com/reference/android/content/Context#registerReceiver(android.content.BroadcastReceiver,%20android.content.IntentFilter)`.

The intent has no extra values, use `https://developer.android.com/reference/android/media/AudioManager#isMicrophoneMute()` to check whether the
microphone is muted.

<br />

Constant Value:

"android.media.action.MICROPHONE_MUTE_CHANGED"


### ACTION_SCO_AUDIO_STATE_CHANGED

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String ACTION_SCO_AUDIO_STATE_CHANGED
```


**This constant was deprecated
in API level 15.**   

Use `https://developer.android.com/reference/android/media/AudioManager#ACTION_SCO_AUDIO_STATE_UPDATED` instead

Sticky broadcast intent action indicating that the Bluetooth SCO audio
connection state has changed. The intent contains on extra `https://developer.android.com/reference/android/media/AudioManager#EXTRA_SCO_AUDIO_STATE`
indicating the new state which is either `https://developer.android.com/reference/android/media/AudioManager#SCO_AUDIO_STATE_DISCONNECTED`
or `https://developer.android.com/reference/android/media/AudioManager#SCO_AUDIO_STATE_CONNECTED`

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#startBluetoothSco()`

Constant Value:

"android.media.SCO_AUDIO_STATE_CHANGED"


### ACTION_SCO_AUDIO_STATE_UPDATED

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String ACTION_SCO_AUDIO_STATE_UPDATED
```


**This constant was deprecated
in API level 37.**   

Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.

Sticky broadcast intent action indicating that the Bluetooth SCO audio
connection state has been updated.

This intent has two extras:

- `https://developer.android.com/reference/android/media/AudioManager#EXTRA_SCO_AUDIO_STATE` - The new SCO audio state.
- `https://developer.android.com/reference/android/media/AudioManager#EXTRA_SCO_AUDIO_PREVIOUS_STATE`- The previous SCO audio state.

EXTRA_SCO_AUDIO_STATE or EXTRA_SCO_AUDIO_PREVIOUS_STATE can be any of:

- `https://developer.android.com/reference/android/media/AudioManager#SCO_AUDIO_STATE_DISCONNECTED`,
- `https://developer.android.com/reference/android/media/AudioManager#SCO_AUDIO_STATE_CONNECTING` or
- `https://developer.android.com/reference/android/media/AudioManager#SCO_AUDIO_STATE_CONNECTED`,

<br />

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#startBluetoothSco()`

Constant Value:

"android.media.ACTION_SCO_AUDIO_STATE_UPDATED"


### ACTION_SPEAKERPHONE_STATE_CHANGED

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String ACTION_SPEAKERPHONE_STATE_CHANGED
```


**This constant was deprecated
in API level 37.**   

Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.

Broadcast Action: speakerphone state changed.

You *cannot* receive this through components declared
in manifests, only by explicitly registering for it with
`https://developer.android.com/reference/android/content/Context#registerReceiver(android.content.BroadcastReceiver,%20android.content.IntentFilter)`.

The intent has no extra values, use `https://developer.android.com/reference/android/media/AudioManager#isSpeakerphoneOn()` to check whether the
speakerphone functionality is enabled or not.

<br />

Constant Value:

"android.media.action.SPEAKERPHONE_STATE_CHANGED"


### ADJUST_LOWER

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ADJUST_LOWER
```

Decrease the ringer volume.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#adjustVolume(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)`

Constant Value:

-1
(0xffffffff)


### ADJUST_MUTE

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ADJUST_MUTE
```

Mute the volume. Has no effect if the stream is already muted.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#adjustVolume(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)`

Constant Value:

-100
(0xffffff9c)


### ADJUST_RAISE

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ADJUST_RAISE
```

Increase the ringer volume.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#adjustVolume(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)`

Constant Value:

1
(0x00000001)


### ADJUST_SAME

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ADJUST_SAME
```

Maintain the previous ringer volume. This may be useful when needing to
show the volume toast without actually modifying the volume.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#adjustVolume(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)`

Constant Value:

0
(0x00000000)


### ADJUST_TOGGLE_MUTE

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ADJUST_TOGGLE_MUTE
```

Toggle the mute state. If muted the stream will be unmuted. If not muted
the stream will be muted.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#adjustVolume(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)`

Constant Value:

101
(0x00000065)


### ADJUST_UNMUTE

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ADJUST_UNMUTE
```

Unmute the volume. Has no effect if the stream is not muted.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#adjustVolume(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)`

Constant Value:

100
(0x00000064)


### AUDIOFOCUS_GAIN

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int AUDIOFOCUS_GAIN
```

Used to indicate a gain of audio focus, or a request of audio focus, of unknown duration.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager.OnAudioFocusChangeListener#onAudioFocusChange(int)`
- `https://developer.android.com/reference/android/media/AudioManager#requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener,%20int,%20int)`

Constant Value:

1
(0x00000001)


### AUDIOFOCUS_GAIN_TRANSIENT

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int AUDIOFOCUS_GAIN_TRANSIENT
```

Used to indicate a temporary gain or request of audio focus, anticipated to last a short
amount of time. Examples of temporary changes are the playback of driving directions, or an
event notification.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager.OnAudioFocusChangeListener#onAudioFocusChange(int)`
- `https://developer.android.com/reference/android/media/AudioManager#requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener,%20int,%20int)`

Constant Value:

2
(0x00000002)


### AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE
```

Used to indicate a temporary request of audio focus, anticipated to last a short
amount of time, during which no other applications, or system components, should play
anything. Examples of exclusive and transient audio focus requests are voice
memo recording and speech recognition, during which the system shouldn't play any
notifications, and media playback should have paused.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener,%20int,%20int)`

Constant Value:

4
(0x00000004)


### AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK
```

Used to indicate a temporary request of audio focus, anticipated to last a short
amount of time, and where it is acceptable for other audio applications to keep playing
after having lowered their output level (also referred to as "ducking").
Examples of temporary changes are the playback of driving directions where playback of music
in the background is acceptable.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager.OnAudioFocusChangeListener#onAudioFocusChange(int)`
- `https://developer.android.com/reference/android/media/AudioManager#requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener,%20int,%20int)`

Constant Value:

3
(0x00000003)


### AUDIOFOCUS_LOSS

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int AUDIOFOCUS_LOSS
```

Used to indicate a loss of audio focus of unknown duration.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager.OnAudioFocusChangeListener#onAudioFocusChange(int)`

Constant Value:

-1
(0xffffffff)


### AUDIOFOCUS_LOSS_TRANSIENT

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int AUDIOFOCUS_LOSS_TRANSIENT
```

Used to indicate a transient loss of audio focus.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager.OnAudioFocusChangeListener#onAudioFocusChange(int)`

Constant Value:

-2
(0xfffffffe)


### AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK
```

Used to indicate a transient loss of audio focus where the loser of the audio focus can
lower its output volume if it wants to continue playing (also referred to as "ducking"), as
the new focus owner doesn't require others to be silent.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager.OnAudioFocusChangeListener#onAudioFocusChange(int)`

Constant Value:

-3
(0xfffffffd)


### AUDIOFOCUS_NONE

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int AUDIOFOCUS_NONE
```

Used to indicate no audio focus has been gained or lost, or requested.

<br />

Constant Value:

0
(0x00000000)


### AUDIOFOCUS_REQUEST_DELAYED

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int AUDIOFOCUS_REQUEST_DELAYED
```

A focus change request whose granting is delayed: the request was successful, but the
requester will only be granted audio focus once the condition that prevented immediate
granting has ended.
See `https://developer.android.com/reference/android/media/AudioManager#requestAudioFocus(android.media.AudioFocusRequest)` and
`https://developer.android.com/reference/android/media/AudioFocusRequest.Builder#setAcceptsDelayedFocusGain(boolean)`

<br />

Constant Value:

2
(0x00000002)


### AUDIOFOCUS_REQUEST_FAILED

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int AUDIOFOCUS_REQUEST_FAILED
```

A failed focus change request.

<br />

Constant Value:

0
(0x00000000)


### AUDIOFOCUS_REQUEST_GRANTED

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int AUDIOFOCUS_REQUEST_GRANTED
```

A successful focus change request.

<br />

Constant Value:

1
(0x00000001)


### AUDIO_SESSION_ID_GENERATE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int AUDIO_SESSION_ID_GENERATE
```

A special audio session ID to indicate that the audio session ID isn't known and the
framework should generate a new value. This can be used when building a new
`https://developer.android.com/reference/android/media/AudioTrack` instance with
`https://developer.android.com/reference/android/media/AudioTrack#AudioTrack(android.media.AudioAttributes,%20android.media.AudioFormat,%20int,%20int,%20int)`.

<br />

Constant Value:

0
(0x00000000)


### DIRECT_PLAYBACK_BITSTREAM_SUPPORTED

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DIRECT_PLAYBACK_BITSTREAM_SUPPORTED
```

Return value for `https://developer.android.com/reference/android/media/AudioManager#getDirectPlaybackSupport(android.media.AudioFormat,%20android.media.AudioAttributes)`:
direct playback supported. This value covers direct playback that is bitstream pass-through
such as compressed pass-through.

<br />

Constant Value:

4
(0x00000004)


### DIRECT_PLAYBACK_NOT_SUPPORTED

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DIRECT_PLAYBACK_NOT_SUPPORTED
```

Return value for `https://developer.android.com/reference/android/media/AudioManager#getDirectPlaybackSupport(android.media.AudioFormat,%20android.media.AudioAttributes)`:
direct playback not supported.

<br />

Constant Value:

0
(0x00000000)


### DIRECT_PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DIRECT_PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED
```

Return value for `https://developer.android.com/reference/android/media/AudioManager#getDirectPlaybackSupport(android.media.AudioFormat,%20android.media.AudioAttributes)`:
direct offload playback supported with gapless transitions. Compressed offload is a variant
of direct playback. It is the feature that allows audio processing tasks to be done on the
Android device but not on the application processor, instead, it is handled by dedicated
hardware such as audio DSPs. That will allow the application processor to be idle as much as
possible, which is good for power saving. Compressed offload playback supports
`https://developer.android.com/reference/android/media/AudioTrack.StreamEventCallback` for event notifications. Gapless transitions
indicates the ability to play consecutive audio tracks without an audio silence in
between.

<br />

Constant Value:

3
(0x00000003)


### DIRECT_PLAYBACK_OFFLOAD_SUPPORTED

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DIRECT_PLAYBACK_OFFLOAD_SUPPORTED
```

Return value for `https://developer.android.com/reference/android/media/AudioManager#getDirectPlaybackSupport(android.media.AudioFormat,%20android.media.AudioAttributes)`:
direct offload playback supported. Compressed offload is a variant of direct playback.
It is the feature that allows audio processing tasks to be done on the Android device but
not on the application processor, instead, it is handled by dedicated hardware such as audio
DSPs. That will allow the application processor to be idle as much as possible, which is
good for power saving. Compressed offload playback supports
`https://developer.android.com/reference/android/media/AudioTrack.StreamEventCallback` for event notifications.

<br />

Constant Value:

1
(0x00000001)


### ENCODED_SURROUND_OUTPUT_ALWAYS

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ENCODED_SURROUND_OUTPUT_ALWAYS
```

The surround sound formats are ALWAYS available, even if they are not detected by the
hardware. Those formats will be reported as part of the HDMI output capability.
Applications are then free to use either PCM or encoded output.

<br />

Constant Value:

2
(0x00000002)


### ENCODED_SURROUND_OUTPUT_AUTO

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ENCODED_SURROUND_OUTPUT_AUTO
```

The surround sound formats are available for use if they are detected. This is the default
mode.

<br />

Constant Value:

0
(0x00000000)


### ENCODED_SURROUND_OUTPUT_MANUAL

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ENCODED_SURROUND_OUTPUT_MANUAL
```

Surround sound formats are available according to the choice of user, even if they are not
detected by the hardware. Those formats will be reported as part of the HDMI output
capability. Applications are then free to use either PCM or encoded output.

<br />

Constant Value:

3
(0x00000003)


### ENCODED_SURROUND_OUTPUT_NEVER

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ENCODED_SURROUND_OUTPUT_NEVER
```

The surround sound formats are NEVER available, even if they are detected by the hardware.
Those formats will not be reported.

<br />

Constant Value:

1
(0x00000001)


### ENCODED_SURROUND_OUTPUT_UNKNOWN

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ENCODED_SURROUND_OUTPUT_UNKNOWN
```

The mode for surround sound formats is unknown.

<br />

Constant Value:

-1
(0xffffffff)


### ERROR

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ERROR
```

A default error code.

<br />

Constant Value:

-1
(0xffffffff)


### ERROR_DEAD_OBJECT

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ERROR_DEAD_OBJECT
```

An error code indicating that the object reporting it is no longer valid and needs to
be recreated.

<br />

Constant Value:

-6
(0xfffffffa)


### EXTRA_AUDIO_PLUG_STATE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_AUDIO_PLUG_STATE
```

Extra used in `https://developer.android.com/reference/android/media/AudioManager#ACTION_HDMI_AUDIO_PLUG` to communicate whether HDMI is plugged in
or unplugged.
An integer value of 1 indicates a plugged-in state, 0 is unplugged.

<br />

Constant Value:

"android.media.extra.AUDIO_PLUG_STATE"


### EXTRA_ENCODINGS

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_ENCODINGS
```

Extra used in `https://developer.android.com/reference/android/media/AudioManager#ACTION_HDMI_AUDIO_PLUG` to define the audio encodings supported by
the connected HDMI device.
The corresponding array of encoding values is only available when the device is plugged in
(as expressed by `https://developer.android.com/reference/android/media/AudioManager#EXTRA_AUDIO_PLUG_STATE`). Encoding values are defined in
`https://developer.android.com/reference/android/media/AudioFormat` (for instance see `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_PCM_16BIT`). Use
`https://developer.android.com/reference/android/content/Intent#getIntArrayExtra(java.lang.String)` to retrieve the encoding values.

<br />

Constant Value:

"android.media.extra.ENCODINGS"


### EXTRA_MAX_CHANNEL_COUNT

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_MAX_CHANNEL_COUNT
```

Extra used in `https://developer.android.com/reference/android/media/AudioManager#ACTION_HDMI_AUDIO_PLUG` to define the maximum number of channels
supported by the HDMI device.
The corresponding integer value is only available when the device is plugged in (as expressed
by `https://developer.android.com/reference/android/media/AudioManager#EXTRA_AUDIO_PLUG_STATE`).

<br />

Constant Value:

"android.media.extra.MAX_CHANNEL_COUNT"


### EXTRA_RINGER_MODE

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_RINGER_MODE
```

The new ringer mode.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_CHANGED_ACTION`
- `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_NORMAL`
- `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_SILENT`
- `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_VIBRATE`

Constant Value:

"android.media.EXTRA_RINGER_MODE"


### EXTRA_SCO_AUDIO_PREVIOUS_STATE

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_SCO_AUDIO_PREVIOUS_STATE
```


**This constant was deprecated
in API level 37.**   

Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.

Extra for intent `https://developer.android.com/reference/android/media/AudioManager#ACTION_SCO_AUDIO_STATE_UPDATED` containing the previous
bluetooth SCO connection state.

<br />

Constant Value:

"android.media.extra.SCO_AUDIO_PREVIOUS_STATE"


### EXTRA_SCO_AUDIO_STATE

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_SCO_AUDIO_STATE
```


**This constant was deprecated
in API level 37.**   

Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.

Extra for intent `https://developer.android.com/reference/android/media/AudioManager#ACTION_SCO_AUDIO_STATE_CHANGED` or
`https://developer.android.com/reference/android/media/AudioManager#ACTION_SCO_AUDIO_STATE_UPDATED` containing the new bluetooth SCO connection state.

<br />

Constant Value:

"android.media.extra.SCO_AUDIO_STATE"


### EXTRA_VIBRATE_SETTING

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_VIBRATE_SETTING
```


**This constant was deprecated
in API level 16.**   

Applications should maintain their own vibrate policy based on
current ringer mode and listen to `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_CHANGED_ACTION` instead.

The new vibrate setting for a particular type.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_SETTING_CHANGED_ACTION`
- `https://developer.android.com/reference/android/media/AudioManager#EXTRA_VIBRATE_TYPE`
- `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_SETTING_ON`
- `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_SETTING_OFF`
- `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_SETTING_ONLY_SILENT`

Constant Value:

"android.media.EXTRA_VIBRATE_SETTING"


### EXTRA_VIBRATE_TYPE

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_VIBRATE_TYPE
```


**This constant was deprecated
in API level 16.**   

Applications should maintain their own vibrate policy based on
current ringer mode and listen to `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_CHANGED_ACTION` instead.

The vibrate type whose setting has changed.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_SETTING_CHANGED_ACTION`
- `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_TYPE_NOTIFICATION`
- `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_TYPE_RINGER`

Constant Value:

"android.media.EXTRA_VIBRATE_TYPE"


### FLAG_ALLOW_RINGER_MODES

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FLAG_ALLOW_RINGER_MODES
```

Whether to include ringer modes as possible options when changing volume.
For example, if true and volume level is 0 and the volume is adjusted
with `https://developer.android.com/reference/android/media/AudioManager#ADJUST_LOWER`, then the ringer mode may switch the silent or
vibrate mode.


By default this is on for the ring stream. If this flag is included,
this behavior will be present regardless of the stream type being
affected by the ringer mode.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#adjustVolume(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)`

Constant Value:

2
(0x00000002)


### FLAG_PLAY_SOUND

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FLAG_PLAY_SOUND
```

Whether to play a sound when changing the volume.


If this is given to `https://developer.android.com/reference/android/media/AudioManager#adjustVolume(int,%20int)` or
`https://developer.android.com/reference/android/media/AudioManager#adjustSuggestedStreamVolume(int,%20int,%20int)`, it may be ignored
in some cases (for example, the decided stream type is not
`https://developer.android.com/reference/android/media/AudioManager#STREAM_RING`, or the volume is being adjusted
downward).

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#adjustVolume(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#setStreamVolume(int,%20int,%20int)`

Constant Value:

4
(0x00000004)


### FLAG_REMOVE_SOUND_AND_VIBRATE

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FLAG_REMOVE_SOUND_AND_VIBRATE
```

Removes any sounds/vibrate that may be in the queue, or are playing (related to
changing volume).

<br />

Constant Value:

8
(0x00000008)


### FLAG_SHOW_UI

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FLAG_SHOW_UI
```

Show a toast containing the current volume.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#adjustVolume(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#setStreamVolume(int,%20int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#setRingerMode(int)`

Constant Value:

1
(0x00000001)


### FLAG_VIBRATE

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FLAG_VIBRATE
```

Whether to vibrate if going into the vibrate ringer mode.

<br />

Constant Value:

16
(0x00000010)


### FX_BACK

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FX_BACK
```

Back sound

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#playSoundEffect(int)`

Constant Value:

10
(0x0000000a)


### FX_FOCUS_NAVIGATION_DOWN

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FX_FOCUS_NAVIGATION_DOWN
```

Focus has moved down

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#playSoundEffect(int)`

Constant Value:

2
(0x00000002)


### FX_FOCUS_NAVIGATION_LEFT

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FX_FOCUS_NAVIGATION_LEFT
```

Focus has moved left

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#playSoundEffect(int)`

Constant Value:

3
(0x00000003)


### FX_FOCUS_NAVIGATION_RIGHT

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FX_FOCUS_NAVIGATION_RIGHT
```

Focus has moved right

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#playSoundEffect(int)`

Constant Value:

4
(0x00000004)


### FX_FOCUS_NAVIGATION_UP

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FX_FOCUS_NAVIGATION_UP
```

Focus has moved up

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#playSoundEffect(int)`

Constant Value:

1
(0x00000001)


### FX_KEYPRESS_DELETE

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FX_KEYPRESS_DELETE
```

IME delete keypress sound

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#playSoundEffect(int)`

Constant Value:

7
(0x00000007)


### FX_KEYPRESS_INVALID

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FX_KEYPRESS_INVALID
```

Invalid keypress sound

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#playSoundEffect(int)`

Constant Value:

9
(0x00000009)


### FX_KEYPRESS_RETURN

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FX_KEYPRESS_RETURN
```

IME return_keypress sound

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#playSoundEffect(int)`

Constant Value:

8
(0x00000008)


### FX_KEYPRESS_SPACEBAR

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FX_KEYPRESS_SPACEBAR
```

IME spacebar keypress sound

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#playSoundEffect(int)`

Constant Value:

6
(0x00000006)


### FX_KEYPRESS_STANDARD

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FX_KEYPRESS_STANDARD
```

IME standard keypress sound

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#playSoundEffect(int)`

Constant Value:

5
(0x00000005)


### FX_KEY_CLICK

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FX_KEY_CLICK
```

Keyboard and direction pad click sound

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#playSoundEffect(int)`

Constant Value:

0
(0x00000000)


### GET_DEVICES_ALL

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GET_DEVICES_ALL
```

Specifies to the `https://developer.android.com/reference/android/media/AudioManager#getDevices(int)` method to include both
source and sink devices.

<br />

Constant Value:

3
(0x00000003)


### GET_DEVICES_INPUTS

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GET_DEVICES_INPUTS
```

Specifies to the `https://developer.android.com/reference/android/media/AudioManager#getDevices(int)` method to include
source (i.e. input) audio devices.

<br />

Constant Value:

1
(0x00000001)


### GET_DEVICES_OUTPUTS

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GET_DEVICES_OUTPUTS
```

Specifies to the `https://developer.android.com/reference/android/media/AudioManager#getDevices(int)` method to include
sink (i.e. output) audio devices.

<br />

Constant Value:

2
(0x00000002)


### MODE_ASSISTANT_CONVERSATION

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int MODE_ASSISTANT_CONVERSATION
```

Use this mode whenever an assistant conversation mode is started.


To check if this mode is allowed to be used by an app, use
`https://developer.android.com/reference/android/media/AudioManager#canManageAssistantAudio()`.

<br />

Constant Value:

7
(0x00000007)


### MODE_CALL_REDIRECT

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_CALL_REDIRECT
```

A telephony call is established and its audio is being redirected to another device.

<br />

Constant Value:

5
(0x00000005)


### MODE_CALL_SCREENING

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_CALL_SCREENING
```

Call screening in progress. Call is connected and audio is accessible to call
screening applications but other audio use cases are still possible.

<br />

Constant Value:

4
(0x00000004)


### MODE_COMMUNICATION_REDIRECT

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_COMMUNICATION_REDIRECT
```

An audio/video chat or VoIP call is established and its audio is being redirected to another
device.

<br />

Constant Value:

6
(0x00000006)


### MODE_CURRENT

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_CURRENT
```

Current audio mode. Used to apply audio routing to current mode.

<br />

Constant Value:

-1
(0xffffffff)


### MODE_INVALID

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_INVALID
```

Invalid audio mode.

<br />

Constant Value:

-2
(0xfffffffe)


### MODE_IN_CALL

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_IN_CALL
```

In call audio mode. A telephony call is established.

<br />

Constant Value:

2
(0x00000002)


### MODE_IN_COMMUNICATION

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_IN_COMMUNICATION
```

In communication audio mode. An audio/video chat or VoIP call is established.

<br />

Constant Value:

3
(0x00000003)


### MODE_NORMAL

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_NORMAL
```

Normal audio mode: not ringing and no call established.

<br />

Constant Value:

0
(0x00000000)


### MODE_RINGTONE

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MODE_RINGTONE
```

Ringing audio mode. An incoming is being signaled.

<br />

Constant Value:

1
(0x00000001)


### NUM_STREAMS

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int NUM_STREAMS
```


**This constant was deprecated
in API level 15.**   

Do not iterate on volume stream type values.

<br />

<br />

Constant Value:

5
(0x00000005)


### PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED
```

Return value for `https://developer.android.com/reference/android/media/AudioManager#getPlaybackOffloadSupport(android.media.AudioFormat,%20android.media.AudioAttributes)`:
offload playback supported with gapless transitions

<br />

Constant Value:

2
(0x00000002)


### PLAYBACK_OFFLOAD_NOT_SUPPORTED

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int PLAYBACK_OFFLOAD_NOT_SUPPORTED
```

Return value for `https://developer.android.com/reference/android/media/AudioManager#getPlaybackOffloadSupport(android.media.AudioFormat,%20android.media.AudioAttributes)`:
offload playback not supported

<br />

Constant Value:

0
(0x00000000)


### PLAYBACK_OFFLOAD_SUPPORTED

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int PLAYBACK_OFFLOAD_SUPPORTED
```

Return value for `https://developer.android.com/reference/android/media/AudioManager#getPlaybackOffloadSupport(android.media.AudioFormat,%20android.media.AudioAttributes)`:
offload playback supported

<br />

Constant Value:

1
(0x00000001)


### PROPERTY_OUTPUT_FRAMES_PER_BUFFER

Added in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String PROPERTY_OUTPUT_FRAMES_PER_BUFFER
```

Used as a key for `https://developer.android.com/reference/android/media/AudioManager#getProperty(java.lang.String)` to request the native or optimal output buffer size
for this device's low latency output stream, in decimal PCM frames. Latency-sensitive apps
should use this value as a minimum, and offer the user the option to override it.
The low latency output stream is typically either the device's primary output stream,
or another output stream with smaller buffers.

<br />

Constant Value:

"android.media.property.OUTPUT_FRAMES_PER_BUFFER"


### PROPERTY_OUTPUT_SAMPLE_RATE

Added in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String PROPERTY_OUTPUT_SAMPLE_RATE
```

Used as a key for `https://developer.android.com/reference/android/media/AudioManager#getProperty(java.lang.String)` to request the native or optimal output sample rate
for this device's low latency output stream, in decimal Hz. Latency-sensitive apps
should use this value as a default, and offer the user the option to override it.
The low latency output stream is typically either the device's primary output stream,
or another output stream with smaller buffers.

<br />

Constant Value:

"android.media.property.OUTPUT_SAMPLE_RATE"


### PROPERTY_SUPPORT_AUDIO_SOURCE_UNPROCESSED

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String PROPERTY_SUPPORT_AUDIO_SOURCE_UNPROCESSED
```

Used as a key for `https://developer.android.com/reference/android/media/AudioManager#getProperty(java.lang.String)` to determine if the unprocessed audio source is
available and supported with the expected frequency range and level response.

<br />

Constant Value:

"android.media.property.SUPPORT_AUDIO_SOURCE_UNPROCESSED"


### PROPERTY_SUPPORT_MIC_NEAR_ULTRASOUND

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String PROPERTY_SUPPORT_MIC_NEAR_ULTRASOUND
```

Used as a key for `https://developer.android.com/reference/android/media/AudioManager#getProperty(java.lang.String)` to determine if the default microphone audio source
supports near-ultrasound frequencies (range of 18 - 21 kHz).

<br />

Constant Value:

"android.media.property.SUPPORT_MIC_NEAR_ULTRASOUND"


### PROPERTY_SUPPORT_SPEAKER_NEAR_ULTRASOUND

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String PROPERTY_SUPPORT_SPEAKER_NEAR_ULTRASOUND
```

Used as a key for `https://developer.android.com/reference/android/media/AudioManager#getProperty(java.lang.String)` to determine if the default speaker audio path
supports near-ultrasound frequencies (range of 18 - 21 kHz).

<br />

Constant Value:

"android.media.property.SUPPORT_SPEAKER_NEAR_ULTRASOUND"


### RINGER_MODE_CHANGED_ACTION

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String RINGER_MODE_CHANGED_ACTION
```

Sticky broadcast intent action indicating that the ringer mode has
changed. Includes the new ringer mode.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#EXTRA_RINGER_MODE`

Constant Value:

"android.media.RINGER_MODE_CHANGED"


### RINGER_MODE_NORMAL

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int RINGER_MODE_NORMAL
```

Ringer mode that may be audible and may vibrate. It will be audible if
the volume before changing out of this mode was audible. It will vibrate
if the vibrate setting is on.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#setRingerMode(int)`
- `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`

Constant Value:

2
(0x00000002)


### RINGER_MODE_SILENT

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int RINGER_MODE_SILENT
```

Ringer mode that will be silent and will not vibrate. (This overrides the
vibrate setting.)

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#setRingerMode(int)`
- `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`

Constant Value:

0
(0x00000000)


### RINGER_MODE_VIBRATE

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int RINGER_MODE_VIBRATE
```

Ringer mode that will be silent and will vibrate. (This will cause the
phone ringer to always vibrate, but the notification vibrate to only
vibrate if set.)

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#setRingerMode(int)`
- `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`

Constant Value:

1
(0x00000001)


### ROUTE_ALL

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ROUTE_ALL
```


**This constant was deprecated
in API level 15.**   

Do not set audio routing directly, use setSpeakerphoneOn(),
setBluetoothScoOn() methods instead.

Used for mask parameter of `https://developer.android.com/reference/android/media/AudioManager#setRouting(int,%20int,%20int)`.

<br />

Constant Value:

-1
(0xffffffff)


### ROUTE_BLUETOOTH

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ROUTE_BLUETOOTH
```


**This constant was deprecated
in API level 15.**   

use `https://developer.android.com/reference/android/media/AudioManager#ROUTE_BLUETOOTH_SCO`Do not set audio routing directly, use setSpeakerphoneOn(),
setBluetoothScoOn() methods instead.

<br />

<br />

Constant Value:

4
(0x00000004)


### ROUTE_BLUETOOTH_A2DP

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ROUTE_BLUETOOTH_A2DP
```


**This constant was deprecated
in API level 15.**   

Do not set audio routing directly, use setSpeakerphoneOn(),
setBluetoothScoOn() methods instead.

Routing audio output to bluetooth A2DP

<br />

Constant Value:

16
(0x00000010)


### ROUTE_BLUETOOTH_SCO

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ROUTE_BLUETOOTH_SCO
```


**This constant was deprecated
in API level 15.**   

Do not set audio routing directly, use setSpeakerphoneOn(),
setBluetoothScoOn() methods instead.

Routing audio output to bluetooth SCO

<br />

Constant Value:

4
(0x00000004)


### ROUTE_EARPIECE

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ROUTE_EARPIECE
```


**This constant was deprecated
in API level 15.**   

Do not set audio routing directly, use setSpeakerphoneOn(),
setBluetoothScoOn() methods instead.

Routing audio output to earpiece

<br />

Constant Value:

1
(0x00000001)


### ROUTE_HEADSET

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ROUTE_HEADSET
```


**This constant was deprecated
in API level 15.**   

Do not set audio routing directly, use setSpeakerphoneOn(),
setBluetoothScoOn() methods instead.

Routing audio output to headset

<br />

Constant Value:

8
(0x00000008)


### ROUTE_SPEAKER

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ROUTE_SPEAKER
```


**This constant was deprecated
in API level 15.**   

Do not set audio routing directly, use setSpeakerphoneOn(),
setBluetoothScoOn() methods instead.

Routing audio output to speaker

<br />

Constant Value:

2
(0x00000002)


### SCO_AUDIO_STATE_CONNECTED

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SCO_AUDIO_STATE_CONNECTED
```


**This constant was deprecated
in API level 37.**   

Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.

Value for extra `https://developer.android.com/reference/android/media/AudioManager#EXTRA_SCO_AUDIO_STATE` or `https://developer.android.com/reference/android/media/AudioManager#EXTRA_SCO_AUDIO_PREVIOUS_STATE`
indicating that the SCO audio channel is established

<br />

Constant Value:

1
(0x00000001)


### SCO_AUDIO_STATE_CONNECTING

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SCO_AUDIO_STATE_CONNECTING
```


**This constant was deprecated
in API level 37.**   

Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.

Value for extra EXTRA_SCO_AUDIO_STATE or EXTRA_SCO_AUDIO_PREVIOUS_STATE
indicating that the SCO audio channel is being established

<br />

Constant Value:

2
(0x00000002)


### SCO_AUDIO_STATE_DISCONNECTED

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SCO_AUDIO_STATE_DISCONNECTED
```


**This constant was deprecated
in API level 37.**   

Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.

Value for extra EXTRA_SCO_AUDIO_STATE or EXTRA_SCO_AUDIO_PREVIOUS_STATE
indicating that the SCO audio channel is not established

<br />

Constant Value:

0
(0x00000000)


### SCO_AUDIO_STATE_ERROR

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SCO_AUDIO_STATE_ERROR
```


**This constant was deprecated
in API level 37.**   

Use `https://developer.android.com/reference/android/media/AudioManager#addOnCommunicationDeviceChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnCommunicationDeviceChangedListener)` instead.

Value for extra EXTRA_SCO_AUDIO_STATE indicating that
there was an error trying to obtain the state

<br />

Constant Value:

-1
(0xffffffff)


### STREAM_ACCESSIBILITY

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STREAM_ACCESSIBILITY
```

Used to identify the volume of audio streams for accessibility prompts

<br />

Constant Value:

10
(0x0000000a)


### STREAM_ALARM

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STREAM_ALARM
```

Used to identify the volume of audio streams for alarms

<br />

Constant Value:

4
(0x00000004)


### STREAM_ASSISTANT

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STREAM_ASSISTANT
```

Used to identify the volume of audio streams for virtual assistant

<br />

Constant Value:

11
(0x0000000b)


### STREAM_DTMF

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STREAM_DTMF
```

Used to identify the volume of audio streams for DTMF Tones

<br />

Constant Value:

8
(0x00000008)


### STREAM_MUSIC

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STREAM_MUSIC
```

Used to identify the volume of audio streams for music playback

<br />

Constant Value:

3
(0x00000003)


### STREAM_NOTIFICATION

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STREAM_NOTIFICATION
```

Used to identify the volume of audio streams for notifications

<br />

Constant Value:

5
(0x00000005)


### STREAM_RING

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STREAM_RING
```

Used to identify the volume of audio streams for the phone ring

<br />

Constant Value:

2
(0x00000002)


### STREAM_SYSTEM

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STREAM_SYSTEM
```

Used to identify the volume of audio streams for system sounds

<br />

Constant Value:

1
(0x00000001)


### STREAM_VOICE_CALL

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STREAM_VOICE_CALL
```

Used to identify the volume of audio streams for phone calls

<br />

Constant Value:

0
(0x00000000)


### USE_DEFAULT_STREAM_TYPE

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int USE_DEFAULT_STREAM_TYPE
```

Suggests using the default stream type. This may not be used in all
places a stream type is needed.

<br />

Constant Value:

-2147483648
(0x80000000)


### VIBRATE_SETTING_CHANGED_ACTION

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String VIBRATE_SETTING_CHANGED_ACTION
```


**This constant was deprecated
in API level 16.**   

Applications should maintain their own vibrate policy based on
current ringer mode and listen to `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_CHANGED_ACTION` instead.

Broadcast intent action indicating that the vibrate setting has
changed. Includes the vibrate type and its new setting.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#EXTRA_VIBRATE_TYPE`
- `https://developer.android.com/reference/android/media/AudioManager#EXTRA_VIBRATE_SETTING`

Constant Value:

"android.media.VIBRATE_SETTING_CHANGED"


### VIBRATE_SETTING_OFF

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int VIBRATE_SETTING_OFF
```


**This constant was deprecated
in API level 16.**   

Applications should maintain their own vibrate policy based on
current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.

Vibrate setting that suggests to never vibrate.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#setVibrateSetting(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#getVibrateSetting(int)`

Constant Value:

0
(0x00000000)


### VIBRATE_SETTING_ON

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int VIBRATE_SETTING_ON
```


**This constant was deprecated
in API level 16.**   

Applications should maintain their own vibrate policy based on
current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.

Vibrate setting that suggests to vibrate when possible.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#setVibrateSetting(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#getVibrateSetting(int)`

Constant Value:

1
(0x00000001)


### VIBRATE_SETTING_ONLY_SILENT

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int VIBRATE_SETTING_ONLY_SILENT
```


**This constant was deprecated
in API level 16.**   

Applications should maintain their own vibrate policy based on
current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.

Vibrate setting that suggests to only vibrate when in the vibrate ringer
mode.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#setVibrateSetting(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#getVibrateSetting(int)`

Constant Value:

2
(0x00000002)


### VIBRATE_TYPE_NOTIFICATION

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int VIBRATE_TYPE_NOTIFICATION
```


**This constant was deprecated
in API level 16.**   

Applications should maintain their own vibrate policy based on
current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.

Vibrate type that corresponds to notifications.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#setVibrateSetting(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#getVibrateSetting(int)`
- `https://developer.android.com/reference/android/media/AudioManager#shouldVibrate(int)`

Constant Value:

1
(0x00000001)


### VIBRATE_TYPE_RINGER

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int VIBRATE_TYPE_RINGER
```


**This constant was deprecated
in API level 16.**   

Applications should maintain their own vibrate policy based on
current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.

Vibrate type that corresponds to the ringer.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#setVibrateSetting(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#getVibrateSetting(int)`
- `https://developer.android.com/reference/android/media/AudioManager#shouldVibrate(int)`

Constant Value:

0
(0x00000000)


## Public methods

### abandonAudioFocus

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int abandonAudioFocus (AudioManager.OnAudioFocusChangeListener l)
```


**This method was deprecated
in API level 26.**   

use `https://developer.android.com/reference/android/media/AudioManager#abandonAudioFocusRequest(android.media.AudioFocusRequest)`

Abandon audio focus. Causes the previous focus owner, if any, to receive focus.

<br />

| Parameters ||
|---|---|
| `l` | `AudioManager.OnAudioFocusChangeListener`: the listener with which focus was requested. <br /> |

| Returns ||
|---|---|
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_REQUEST_FAILED` or `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_REQUEST_GRANTED` <br /> |

### abandonAudioFocusRequest

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int abandonAudioFocusRequest (AudioFocusRequest focusRequest)
```

Abandon audio focus. Causes the previous focus owner, if any, to receive focus.

<br />

| Parameters ||
|---|---|
| `focusRequest` | `AudioFocusRequest`: the `https://developer.android.com/reference/android/media/AudioFocusRequest` that was used when requesting focus with `https://developer.android.com/reference/android/media/AudioManager#requestAudioFocus(android.media.AudioFocusRequest)`. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_REQUEST_FAILED` or `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_REQUEST_GRANTED` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if passed a null argument |

### addOnCommunicationDeviceChangedListener

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addOnCommunicationDeviceChangedListener (Executor executor, 
                AudioManager.OnCommunicationDeviceChangedListener listener)
```

Adds a listener for being notified of changes to the communication audio device.
See `https://developer.android.com/reference/android/media/AudioManager#setCommunicationDevice(android.media.AudioDeviceInfo)`.

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `listener` | `AudioManager.OnCommunicationDeviceChangedListener`: This value cannot be `null`. <br /> |

### addOnModeChangedListener

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addOnModeChangedListener (Executor executor, 
                AudioManager.OnModeChangedListener listener)
```

Adds a listener to be notified of changes to the audio mode.
See `https://developer.android.com/reference/android/media/AudioManager#getMode()`

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `listener` | `AudioManager.OnModeChangedListener`: This value cannot be `null`. <br /> |

### addOnPreferredMixerAttributesChangedListener

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addOnPreferredMixerAttributesChangedListener (Executor executor, 
                AudioManager.OnPreferredMixerAttributesChangedListener listener)
```

Adds a listener for being notified of changes to the preferred mixer attributes.

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: the executor to execute the callback. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `listener` | `AudioManager.OnPreferredMixerAttributesChangedListener`: the listener to be notified of changes in the preferred mixer attributes. This value cannot be `null`. <br /> |

### adjustStreamVolume

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void adjustStreamVolume (int streamType, 
                int direction, 
                int flags)
```

Adjusts the volume of a particular stream by one step in a direction.


This method should only be used by applications that replace the platform-wide
management of audio settings or the main telephony application.

This method has no effect if the device implements a fixed volume policy
as indicated by `https://developer.android.com/reference/android/media/AudioManager#isVolumeFixed()`.

From N onward, ringer mode adjustments that would toggle Do Not Disturb are not allowed
unless the app has been granted Notification Policy Access.
See `https://developer.android.com/reference/android/app/NotificationManager#isNotificationPolicyAccessGranted()`.

<br />

| Parameters ||
|---|---|
| `streamType` | `int`: The stream type to adjust. One of `https://developer.android.com/reference/android/media/AudioManager#STREAM_VOICE_CALL`, `https://developer.android.com/reference/android/media/AudioManager#STREAM_SYSTEM`, `https://developer.android.com/reference/android/media/AudioManager#STREAM_RING`, `https://developer.android.com/reference/android/media/AudioManager#STREAM_MUSIC`, `https://developer.android.com/reference/android/media/AudioManager#STREAM_ALARM` or `https://developer.android.com/reference/android/media/AudioManager#STREAM_ACCESSIBILITY`. <br /> |
| `direction` | `int`: The direction to adjust the volume. One of `https://developer.android.com/reference/android/media/AudioManager#ADJUST_LOWER`, `https://developer.android.com/reference/android/media/AudioManager#ADJUST_RAISE`, or `https://developer.android.com/reference/android/media/AudioManager#ADJUST_SAME`. <br /> |
| `flags` | `int`: Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/media/AudioManager#FLAG_SHOW_UI` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_ALLOW_RINGER_MODES` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_PLAY_SOUND` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_REMOVE_SOUND_AND_VIBRATE` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_VIBRATE` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/SecurityException` | if the adjustment triggers a Do Not Disturb change and the caller is not granted notification policy access. |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#adjustVolume(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#setStreamVolume(int,%20int,%20int)`

### adjustSuggestedStreamVolume

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void adjustSuggestedStreamVolume (int direction, 
                int suggestedStreamType, 
                int flags)
```

Adjusts the volume of the most relevant stream, or the given fallback
stream.


This method should only be used by applications that replace the
platform-wide management of audio settings or the main telephony
application.


This method has no effect if the device implements a fixed volume policy
as indicated by `https://developer.android.com/reference/android/media/AudioManager#isVolumeFixed()`.

<br />

| Parameters ||
|---|---|
| `direction` | `int`: The direction to adjust the volume. One of `https://developer.android.com/reference/android/media/AudioManager#ADJUST_LOWER`, `https://developer.android.com/reference/android/media/AudioManager#ADJUST_RAISE`, `https://developer.android.com/reference/android/media/AudioManager#ADJUST_SAME`, `https://developer.android.com/reference/android/media/AudioManager#ADJUST_MUTE`, `https://developer.android.com/reference/android/media/AudioManager#ADJUST_UNMUTE`, or `https://developer.android.com/reference/android/media/AudioManager#ADJUST_TOGGLE_MUTE`. <br /> |
| `suggestedStreamType` | `int`: The stream type that will be used if there isn't a relevant stream. `https://developer.android.com/reference/android/media/AudioManager#USE_DEFAULT_STREAM_TYPE` is valid here. <br /> |
| `flags` | `int`: Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/media/AudioManager#FLAG_SHOW_UI` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_ALLOW_RINGER_MODES` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_PLAY_SOUND` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_REMOVE_SOUND_AND_VIBRATE` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_VIBRATE` |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#adjustVolume(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#setStreamVolume(int,%20int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#isVolumeFixed()`

### adjustVolume

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void adjustVolume (int direction, 
                int flags)
```

Adjusts the volume of the most relevant stream. For example, if a call is
active, it will have the highest priority regardless of if the in-call
screen is showing. Another example, if music is playing in the background
and a call is not active, the music stream will be adjusted.


This method should only be used by applications that replace the
platform-wide management of audio settings or the main telephony
application.


This method has no effect if the device implements a fixed volume policy
as indicated by `https://developer.android.com/reference/android/media/AudioManager#isVolumeFixed()`.

<br />

| Parameters ||
|---|---|
| `direction` | `int`: The direction to adjust the volume. One of `https://developer.android.com/reference/android/media/AudioManager#ADJUST_LOWER`, `https://developer.android.com/reference/android/media/AudioManager#ADJUST_RAISE`, `https://developer.android.com/reference/android/media/AudioManager#ADJUST_SAME`, `https://developer.android.com/reference/android/media/AudioManager#ADJUST_MUTE`, `https://developer.android.com/reference/android/media/AudioManager#ADJUST_UNMUTE`, or `https://developer.android.com/reference/android/media/AudioManager#ADJUST_TOGGLE_MUTE`. <br /> |
| `flags` | `int`: Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/media/AudioManager#FLAG_SHOW_UI` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_ALLOW_RINGER_MODES` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_PLAY_SOUND` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_REMOVE_SOUND_AND_VIBRATE` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_VIBRATE` |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#adjustSuggestedStreamVolume(int,%20int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#setStreamVolume(int,%20int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#isVolumeFixed()`

### adjustVolumeGroupVolume

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void adjustVolumeGroupVolume (int groupId, 
                int direction, 
                int flags)
```

Adjusts the volume of a particular group associated to given id by one step in a direction.

If the volume group is associated to a stream type, it fallbacks on
`https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)` for compatibility reason.

Call first in prior `https://developer.android.com/reference/android/media/AudioManager#getVolumeGroupIdForAttributes(android.media.AudioAttributes)` to retrieve
the volume group id supporting the given `https://developer.android.com/reference/android/media/AudioAttributes`.

<br />

| Parameters ||
|---|---|
| `groupId` | `int`: of the audio volume group to consider. <br /> |
| `direction` | `int`: The direction to adjust the volume. One of `https://developer.android.com/reference/android/media/AudioManager#ADJUST_LOWER`, `https://developer.android.com/reference/android/media/AudioManager#ADJUST_RAISE`, or `https://developer.android.com/reference/android/media/AudioManager#ADJUST_SAME`. <br /> |
| `flags` | `int`: Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/media/AudioManager#FLAG_SHOW_UI` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_ALLOW_RINGER_MODES` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_PLAY_SOUND` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_REMOVE_SOUND_AND_VIBRATE` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_VIBRATE` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/SecurityException` | if the adjustment triggers a Do Not Disturb change and the caller is not granted notification policy access. |

### canManageAssistantAudio

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public boolean canManageAssistantAudio ()
```

Checks if the calling app can manage assistant audio.

To request access, use `https://developer.android.com/reference/android/provider/Settings#ACTION_MANAGE_ASSISTANT_AUDIO`

<br />

| Returns ||
|---|---|
| `boolean` | true if the calling app can manage assistant audio, false otherwise. <br /> |

### clearCommunicationDevice

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void clearCommunicationDevice ()
```

Cancels previous communication device selection made with
`https://developer.android.com/reference/android/media/AudioManager#setCommunicationDevice(android.media.AudioDeviceInfo)`.

<br />

### clearPreferredMixerAttributes

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean clearPreferredMixerAttributes (AudioAttributes attributes, 
                AudioDeviceInfo device)
```

Clears the current preferred mixer attributes that were previously set via
`https://developer.android.com/reference/android/media/AudioManager#setPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo,%20android.media.AudioMixerAttributes)`


Requires `https://developer.android.com/reference/android/Manifest.permission#MODIFY_AUDIO_SETTINGS`

<br />

| Parameters ||
|---|---|
| `attributes` | `AudioAttributes`: the `https://developer.android.com/reference/android/media/AudioAttributes` whose mixer attributes should be cleared. This value cannot be `null`. <br /> |
| `device` | `AudioDeviceInfo`: the expected routing device. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | true only if the preferred mixer attributes are removed successfully. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#setPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo,%20android.media.AudioMixerAttributes)`
- `https://developer.android.com/reference/android/media/AudioManager#getPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo)`

### dispatchMediaKeyEvent

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void dispatchMediaKeyEvent (KeyEvent keyEvent)
```

Sends a simulated key event for a media button. To simulate a key press, you must first send
a KeyEvent built with a `https://developer.android.com/reference/android/view/KeyEvent#ACTION_DOWN` action, then another event with the
`https://developer.android.com/reference/android/view/KeyEvent#ACTION_UP` action.

The key event will be sent to the current media key event consumer which registered with
`https://developer.android.com/reference/android/media/AudioManager#registerMediaButtonEventReceiver(android.app.PendingIntent)`.

<br />

| Parameters ||
|---|---|
| `keyEvent` | `KeyEvent`: a media session `https://developer.android.com/reference/android/view/KeyEvent`, as defined by `https://developer.android.com/reference/android/view/KeyEvent#isMediaSessionKey(int)`. <br /> |

### generateAudioSessionId

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int generateAudioSessionId ()
```

Return a new audio session identifier not associated with any player or effect.
An audio session identifier is a system wide unique identifier for a set of audio streams
(one or more mixed together).

The primary use of the audio session ID is to associate audio effects to audio players,
such as `https://developer.android.com/reference/android/media/MediaPlayer` or `https://developer.android.com/reference/android/media/AudioTrack`: all audio effects sharing the same audio
session ID will be applied to the mixed audio content of the players that share the same
audio session.

This method can for instance be used when creating one of the
`https://developer.android.com/reference/android/media/audiofx/AudioEffect` objects to define the audio session of the effect,
or to specify a session for a speech synthesis utterance
in `https://developer.android.com/reference/android/speech/tts/TextToSpeech.Engine`.

<br />

| Returns ||
|---|---|
| `int` | a new unclaimed and unused audio session identifier, or `https://developer.android.com/reference/android/media/AudioManager#ERROR` when the system failed to generate a new session, a condition in which audio playback or recording will subsequently fail as well. <br /> |

### getActivePlaybackConfigurations

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<AudioPlaybackConfiguration> getActivePlaybackConfigurations ()
```

Returns the current active audio playback configurations of the device

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/AudioPlaybackConfiguration>` | a non-null list of playback configurations. An empty list indicates there is no playback active when queried. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioPlaybackConfiguration`

### getActiveRecordingConfigurations

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<AudioRecordingConfiguration> getActiveRecordingConfigurations ()
```

Returns the current active audio recording configurations of the device.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/AudioRecordingConfiguration>` | a non-null list of recording configurations. An empty list indicates there is no recording active when queried. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioRecordingConfiguration`

### getAllowedCapturePolicy

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getAllowedCapturePolicy ()
```

Return the capture policy.

<br />

| Returns ||
|---|---|
| `int` | the capture policy set by `https://developer.android.com/reference/android/media/AudioManager#setAllowedCapturePolicy(int)` or the default if it was not called. Value is one of the following: - `https://developer.android.com/reference/android/media/AudioAttributes#ALLOW_CAPTURE_BY_ALL` - `https://developer.android.com/reference/android/media/AudioAttributes#ALLOW_CAPTURE_BY_SYSTEM` - `https://developer.android.com/reference/android/media/AudioAttributes#ALLOW_CAPTURE_BY_NONE` |

### getAudioDevicesForAttributes

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<AudioDeviceInfo> getAudioDevicesForAttributes (AudioAttributes attributes)
```

Get the audio devices that would be used for the routing of the given audio attributes.
These are the devices anticipated to play sound from an `https://developer.android.com/reference/android/media/AudioTrack` created with
the specified `https://developer.android.com/reference/android/media/AudioAttributes`.
The audio routing can change if audio devices are physically connected or disconnected or
concurrently through `https://developer.android.com/reference/android/media/AudioRouting` or `https://developer.android.com/reference/android/media/MediaRouter`.

<br />

| Parameters ||
|---|---|
| `attributes` | `AudioAttributes`: the `https://developer.android.com/reference/android/media/AudioAttributes` for which the routing is being queried. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/AudioDeviceInfo>` | an empty list if there was an issue with the request, a list of `https://developer.android.com/reference/android/media/AudioDeviceInfo` otherwise (typically one device, except for duplicated paths). This value cannot be `null`. <br /> |

### getAudioHwSyncForSession

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getAudioHwSyncForSession (int sessionId)
```

Retrieves the Hardware A/V synchronization ID corresponding to the given audio session ID.
For more details on Hardware A/V synchronization please refer to
[media tunneling documentation](https://source.android.com/devices/tv/multimedia-tunneling/).

<br />

| Parameters ||
|---|---|
| `sessionId` | `int`: the audio session ID for which the HW A/V sync ID is retrieved. <br /> |

| Returns ||
|---|---|
| `int` | the HW A/V sync ID for this audio session (an integer different from 0). <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | if HW A/V synchronization is not supported. |

### getAvailableCommunicationDevices

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<AudioDeviceInfo> getAvailableCommunicationDevices ()
```

Returns a list of audio devices that can be selected for communication use cases via
`https://developer.android.com/reference/android/media/AudioManager#setCommunicationDevice(android.media.AudioDeviceInfo)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/AudioDeviceInfo>` | a list of `https://developer.android.com/reference/android/media/AudioDeviceInfo` suitable for use with setCommunicationDevice(). This value cannot be `null`. <br /> |

### getCommunicationDevice

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public AudioDeviceInfo getCommunicationDevice ()
```

Returns currently selected audio device for communication.

This API replaces the following deprecated APIs:

- `https://developer.android.com/reference/android/media/AudioManager#isBluetoothScoOn()`
- `https://developer.android.com/reference/android/media/AudioManager#isSpeakerphoneOn()`

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/AudioDeviceInfo` | an `https://developer.android.com/reference/android/media/AudioDeviceInfo` indicating which audio device is currently selected for communication use cases. Can be null on platforms not supporting `https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_TELEPHONY`. is used. <br /> |

### getDevices

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public AudioDeviceInfo[] getDevices (int flags)
```

Returns an array of `https://developer.android.com/reference/android/media/AudioDeviceInfo` objects corresponding to the audio devices
currently connected to the system and meeting the criteria specified in the
`flags` parameter.

<br />

| Parameters ||
|---|---|
| `flags` | `int`: A set of bitflags specifying the criteria to test. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/media/AudioManager#GET_DEVICES_INPUTS` - `https://developer.android.com/reference/android/media/AudioManager#GET_DEVICES_OUTPUTS` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/AudioDeviceInfo` | A (possibly zero-length) array of AudioDeviceInfo objects. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#GET_DEVICES_OUTPUTS`
- `https://developer.android.com/reference/android/media/AudioManager#GET_DEVICES_INPUTS`
- `https://developer.android.com/reference/android/media/AudioManager#GET_DEVICES_ALL`

### getDirectPlaybackSupport

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int getDirectPlaybackSupport (AudioFormat format, 
                AudioAttributes attributes)
```

Returns a bitfield representing the different forms of direct playback currently available
for a given audio format.

Direct playback means that the audio stream is not altered by the framework. The audio
stream will not be resampled, volume scaled, downmixed or mixed with other content by
the framework. But it may be wrapped in a higher level protocol such as IEC61937 for
passthrough.

Checking for direct support can help the app select the representation of audio content
that most closely matches the capabilities of the device and peripherals (e.g. A/V receiver)
connected to it. Note that the provided stream can still be re-encoded or mixed with other
streams, if needed.

<br />

| Parameters ||
|---|---|
| `format` | `AudioFormat`: the audio format (codec, sample rate, channels) being checked. This value cannot be `null`. <br /> |
| `attributes` | `AudioAttributes`: the `https://developer.android.com/reference/android/media/AudioAttributes` to be used for playback. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `int` | the direct playback mode available with given format and attributes. The returned value will be `https://developer.android.com/reference/android/media/AudioManager#DIRECT_PLAYBACK_NOT_SUPPORTED` or a combination of `https://developer.android.com/reference/android/media/AudioManager#DIRECT_PLAYBACK_OFFLOAD_SUPPORTED`, `https://developer.android.com/reference/android/media/AudioManager#DIRECT_PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED` and `https://developer.android.com/reference/android/media/AudioManager#DIRECT_PLAYBACK_BITSTREAM_SUPPORTED`. Note that if `https://developer.android.com/reference/android/media/AudioManager#DIRECT_PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED` is present in the returned value, then `https://developer.android.com/reference/android/media/AudioManager#DIRECT_PLAYBACK_OFFLOAD_SUPPORTED` will be too. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/media/AudioManager#DIRECT_PLAYBACK_NOT_SUPPORTED` - `https://developer.android.com/reference/android/media/AudioManager#DIRECT_PLAYBACK_OFFLOAD_SUPPORTED` - `https://developer.android.com/reference/android/media/AudioManager#DIRECT_PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED` - `https://developer.android.com/reference/android/media/AudioManager#DIRECT_PLAYBACK_BITSTREAM_SUPPORTED` |

### getDirectProfilesForAttributes

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<AudioProfile> getDirectProfilesForAttributes (AudioAttributes attributes)
```

Returns a list of direct `https://developer.android.com/reference/android/media/AudioProfile` that are supported for the specified
`https://developer.android.com/reference/android/media/AudioAttributes`. This can be empty in case of an error or if no direct playback
is possible.

Direct playback means that the audio stream is not resampled or downmixed
by the framework. Checking for direct support can help the app select the representation
of audio content that most closely matches the capabilities of the device and peripherals
(e.g. A/V receiver) connected to it. Note that the provided stream can still be re-encoded
or mixed with other streams, if needed.

When using this information to inform your application which audio format to play,
query again whenever audio output devices change (see `https://developer.android.com/reference/android/media/AudioDeviceCallback`).

<br />

| Parameters ||
|---|---|
| `attributes` | `AudioAttributes`: a non-null `https://developer.android.com/reference/android/media/AudioAttributes` instance. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/AudioProfile>` | a list of `https://developer.android.com/reference/android/media/AudioProfile` This value cannot be `null`. <br /> |

### getDirectProfilesForAttributes

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public List<AudioProfile> getDirectProfilesForAttributes (AudioAttributes attributes, 
                int uid)
```

Returns a list of direct `https://developer.android.com/reference/android/media/AudioProfile` that are supported for the specified
`https://developer.android.com/reference/android/media/AudioAttributes`. This can be empty in case of an error or if no direct playback
is possible.

Direct playback means that the audio stream is not resampled or downmixed
by the framework. Checking for direct support can help the app select the representation
of audio content that most closely matches the capabilities of the device and peripherals
(e.g. A/V receiver) connected to it. Note that the provided stream can still be re-encoded
or mixed with other streams, if needed.

When using this information to inform your application which audio format to play,
query again whenever audio output devices change (see `https://developer.android.com/reference/android/media/AudioDeviceCallback`).

<br />

| Parameters ||
|---|---|
| `attributes` | `AudioAttributes`: a non-null `https://developer.android.com/reference/android/media/AudioAttributes` instance. <br /> |
| `uid` | `int`: Application/Service UID for the query <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/AudioProfile>` | a list of `https://developer.android.com/reference/android/media/AudioProfile` This value cannot be `null`. <br /> |

### getEncodedSurroundMode

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getEncodedSurroundMode ()
```

Gets the surround sound mode.

<br />

| Returns ||
|---|---|
| `int` | true if successful, otherwise false. Value is one of the following: - `https://developer.android.com/reference/android/media/AudioManager#ENCODED_SURROUND_OUTPUT_UNKNOWN` - `https://developer.android.com/reference/android/media/AudioManager#ENCODED_SURROUND_OUTPUT_AUTO` - `https://developer.android.com/reference/android/media/AudioManager#ENCODED_SURROUND_OUTPUT_NEVER` - `https://developer.android.com/reference/android/media/AudioManager#ENCODED_SURROUND_OUTPUT_ALWAYS` - `https://developer.android.com/reference/android/media/AudioManager#ENCODED_SURROUND_OUTPUT_MANUAL` |

### getMicrophones

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<MicrophoneInfo> getMicrophones ()
```

Returns a list of `https://developer.android.com/reference/android/media/MicrophoneInfo` that corresponds to the characteristics
of all available microphones. The list is empty when no microphones are available
on the device. An error during the query will result in an IOException being thrown.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/MicrophoneInfo>` | a list that contains all microphones' characteristics <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` | if an error occurs. |

### getMode

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getMode ()
```

Returns the current audio mode.

<br />

| Returns ||
|---|---|
| `int` | the current audio mode. Value is one of the following: - `https://developer.android.com/reference/android/media/AudioManager#MODE_NORMAL` - `https://developer.android.com/reference/android/media/AudioManager#MODE_RINGTONE` - `https://developer.android.com/reference/android/media/AudioManager#MODE_IN_CALL` - `https://developer.android.com/reference/android/media/AudioManager#MODE_IN_COMMUNICATION` - `https://developer.android.com/reference/android/media/AudioManager#MODE_CALL_SCREENING` - `https://developer.android.com/reference/android/media/AudioManager#MODE_CALL_REDIRECT` - `https://developer.android.com/reference/android/media/AudioManager#MODE_COMMUNICATION_REDIRECT` - `https://developer.android.com/reference/android/media/AudioManager#MODE_ASSISTANT_CONVERSATION` |

### getParameters

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getParameters (String keys)
```

Gets a variable number of parameter values from audio hardware.

<br />

| Parameters ||
|---|---|
| `keys` | `String`: list of parameters <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | list of parameters key value pairs in the form: key1=value1;key2=value2;... <br /> |

### getPlaybackOffloadSupport

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int getPlaybackOffloadSupport (AudioFormat format, 
                AudioAttributes attributes)
```


**This method was deprecated
in API level 33.**   

Use `https://developer.android.com/reference/android/media/AudioManager#getDirectPlaybackSupport(android.media.AudioFormat,%20android.media.AudioAttributes)` instead

Returns whether offloaded playback of an audio format is supported on the device or not and
when supported whether gapless transitions are possible or not.

Offloaded playback is the feature where the decoding and playback of an audio stream
is not competing with other software resources. In general, it is supported by dedicated
hardware, such as audio DSPs.

Note that this query only provides information about the support of an audio format,
it does not indicate whether the resources necessary for the offloaded playback are
available at that instant.

<br />

| Parameters ||
|---|---|
| `format` | `AudioFormat`: the audio format (codec, sample rate, channels) being checked. This value cannot be `null`. <br /> |
| `attributes` | `AudioAttributes`: the `https://developer.android.com/reference/android/media/AudioAttributes` to be used for playback. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `int` | `https://developer.android.com/reference/android/media/AudioManager#PLAYBACK_OFFLOAD_NOT_SUPPORTED` if offload playback if not supported, `https://developer.android.com/reference/android/media/AudioManager#PLAYBACK_OFFLOAD_SUPPORTED` if offload playback is supported or `https://developer.android.com/reference/android/media/AudioManager#PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED` if gapless transitions are also supported. Value is one of the following: - `https://developer.android.com/reference/android/media/AudioManager#PLAYBACK_OFFLOAD_NOT_SUPPORTED` - `https://developer.android.com/reference/android/media/AudioManager#PLAYBACK_OFFLOAD_SUPPORTED` - `https://developer.android.com/reference/android/media/AudioManager#PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED` |

### getPreferredMixerAttributes

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public AudioMixerAttributes getPreferredMixerAttributes (AudioAttributes attributes, 
                AudioDeviceInfo device)
```

Returns current preferred mixer attributes that is set via
`https://developer.android.com/reference/android/media/AudioManager#setPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo,%20android.media.AudioMixerAttributes)`

<br />

| Parameters ||
|---|---|
| `attributes` | `AudioAttributes`: the `https://developer.android.com/reference/android/media/AudioAttributes` whose mixer attributes should be set. This value cannot be `null`. <br /> |
| `device` | `AudioDeviceInfo`: the expected routing device. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/AudioMixerAttributes` | the preferred mixer attributes, which will be null when no preferred mixer attributes have been set, or when they have been cleared. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#setPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo,%20android.media.AudioMixerAttributes)`
- `https://developer.android.com/reference/android/media/AudioManager#clearPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo)`

### getProperty

Added in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getProperty (String key)
```

Returns the value of the property with the specified key.

<br />

| Parameters ||
|---|---|
| `key` | `String`: One of the strings corresponding to a property key: either `https://developer.android.com/reference/android/media/AudioManager#PROPERTY_OUTPUT_SAMPLE_RATE`, `https://developer.android.com/reference/android/media/AudioManager#PROPERTY_OUTPUT_FRAMES_PER_BUFFER`, `https://developer.android.com/reference/android/media/AudioManager#PROPERTY_SUPPORT_MIC_NEAR_ULTRASOUND`, `https://developer.android.com/reference/android/media/AudioManager#PROPERTY_SUPPORT_SPEAKER_NEAR_ULTRASOUND`, or `https://developer.android.com/reference/android/media/AudioManager#PROPERTY_SUPPORT_AUDIO_SOURCE_UNPROCESSED`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | A string representing the associated value for that property key, or null if there is no value for that key. <br /> |

### getRingerMode

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getRingerMode ()
```

Returns the current ringtone mode.

<br />

| Returns ||
|---|---|
| `int` | The current ringtone mode, one of `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_NORMAL`, `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_SILENT`, or `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_VIBRATE`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#setRingerMode(int)`

### getRouting

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getRouting (int mode)
```


**This method was deprecated
in API level 15.**   

Do not query audio routing directly, use isSpeakerphoneOn(),
isBluetoothScoOn(), isBluetoothA2dpOn() and isWiredHeadsetOn() methods instead.

Returns the current audio routing bit vector for a specified mode.

<br />

| Parameters ||
|---|---|
| `mode` | `int`: audio mode to get route (e.g., MODE_RINGTONE) <br /> |

| Returns ||
|---|---|
| `int` | an audio route bit vector that can be compared with ROUTE_xxx bits <br /> |

### getSpatializer

Added in [API level 32](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Spatializer getSpatializer ()
```

Return a handle to the optional platform's `https://developer.android.com/reference/android/media/Spatializer`

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/Spatializer` | the `Spatializer` instance. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/Spatializer#getImmersiveAudioLevel()`

### getStreamMaxVolume

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getStreamMaxVolume (int streamType)
```

Returns the maximum volume index for a particular stream.

<br />

| Parameters ||
|---|---|
| `streamType` | `int`: The stream type whose maximum volume index is returned. <br /> |

| Returns ||
|---|---|
| `int` | The maximum valid volume index for the stream. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#getStreamVolume(int)`

### getStreamMinVolume

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getStreamMinVolume (int streamType)
```

Returns the minimum volume index for a particular stream.

<br />

| Parameters ||
|---|---|
| `streamType` | `int`: The stream type whose minimum volume index is returned. Must be one of `https://developer.android.com/reference/android/media/AudioManager#STREAM_VOICE_CALL`, `https://developer.android.com/reference/android/media/AudioManager#STREAM_SYSTEM`, `https://developer.android.com/reference/android/media/AudioManager#STREAM_RING`, `https://developer.android.com/reference/android/media/AudioManager#STREAM_MUSIC`, `https://developer.android.com/reference/android/media/AudioManager#STREAM_ALARM`, `https://developer.android.com/reference/android/media/AudioManager#STREAM_NOTIFICATION`, `https://developer.android.com/reference/android/media/AudioManager#STREAM_DTMF` or `https://developer.android.com/reference/android/media/AudioManager#STREAM_ACCESSIBILITY`. <br /> |

| Returns ||
|---|---|
| `int` | The minimum valid volume index for the stream. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#getStreamVolume(int)`

### getStreamVolume

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getStreamVolume (int streamType)
```

Returns the current volume index for a particular stream.

<br />

| Parameters ||
|---|---|
| `streamType` | `int`: The stream type whose volume index is returned. <br /> |

| Returns ||
|---|---|
| `int` | The current volume index for the stream. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#getStreamMaxVolume(int)`
- `https://developer.android.com/reference/android/media/AudioManager#setStreamVolume(int,%20int,%20int)`

### getStreamVolumeDb

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float getStreamVolumeDb (int streamType, 
                int index, 
                int deviceType)
```

Returns the volume in dB (decibel) for the given stream type at the given volume index, on
the given type of audio output device.

<br />

| Parameters ||
|---|---|
| `streamType` | `int`: stream type for which the volume is queried. Value is one of the following: - `https://developer.android.com/reference/android/media/AudioManager#STREAM_VOICE_CALL` - `https://developer.android.com/reference/android/media/AudioManager#STREAM_SYSTEM` - `https://developer.android.com/reference/android/media/AudioManager#STREAM_RING` - `https://developer.android.com/reference/android/media/AudioManager#STREAM_MUSIC` - `https://developer.android.com/reference/android/media/AudioManager#STREAM_ALARM` - `https://developer.android.com/reference/android/media/AudioManager#STREAM_NOTIFICATION` - `https://developer.android.com/reference/android/media/AudioManager#STREAM_DTMF` - `https://developer.android.com/reference/android/media/AudioManager#STREAM_ACCESSIBILITY` - `https://developer.android.com/reference/android/media/AudioManager#STREAM_ASSISTANT` |
| `index` | `int`: the volume index for which the volume is queried. The index value must be between the minimum and maximum index values for the given stream type (see `https://developer.android.com/reference/android/media/AudioManager#getStreamMinVolume(int)` and `https://developer.android.com/reference/android/media/AudioManager#getStreamMaxVolume(int)`). <br /> |
| `deviceType` | `int`: the type of audio output device for which volume is queried. Value is one of the following: - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_BUILTIN_EARPIECE` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_BUILTIN_SPEAKER` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_WIRED_HEADSET` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_WIRED_HEADPHONES` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_BLUETOOTH_SCO` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_BLUETOOTH_A2DP` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_HDMI` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_DOCK` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_USB_ACCESSORY` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_USB_DEVICE` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_USB_HEADSET` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_TELEPHONY` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_LINE_ANALOG` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_HDMI_ARC` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_HDMI_EARC` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_LINE_DIGITAL` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_FM` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_AUX_LINE` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_IP` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_BUS` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_REMOTE_SUBMIX` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_HEARING_AID` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_BUILTIN_SPEAKER_SAFE` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_BLE_HEADSET` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_BLE_SPEAKER` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_BLE_BROADCAST` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_DOCK_ANALOG` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_MULTICHANNEL_GROUP` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_BLE_HEARING_AID` - `https://developer.android.com/reference/android/media/AudioDeviceInfo#TYPE_BLE_CENTRAL` |

| Returns ||
|---|---|
| `float` | a volume expressed in dB. A negative value indicates the audio signal is attenuated. A typical maximum value at the maximum volume index is 0 dB (no attenuation nor amplification). Muting is reflected by a value of `https://developer.android.com/reference/java/lang/Float#NEGATIVE_INFINITY`. <br /> |

### getSupportedDeviceTypes

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Set<Integer> getSupportedDeviceTypes (int direction)
```

Returns a Set of unique Integers corresponding to audio device type identifiers that can
*potentially* be connected to the system and meeting the criteria specified in the
`direction` parameter.
Note that this set contains `https://developer.android.com/reference/android/media/AudioDeviceInfo` device type identifiers for both devices
currently available *and* those that can be available if the user connects an audio
peripheral. Examples include TYPE_WIRED_HEADSET if the Android device supports an analog
headset jack or TYPE_USB_DEVICE if the Android device supports a USB host-mode port.
These are generally a superset of device type identifiers associated with the
AudioDeviceInfo objects returned from AudioManager.getDevices().

<br />

| Parameters ||
|---|---|
| `direction` | `int`: The constant specifying whether input or output devices are queried. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/media/AudioManager#GET_DEVICES_INPUTS` - `https://developer.android.com/reference/android/media/AudioManager#GET_DEVICES_OUTPUTS` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/lang/Integer>` | A (possibly zero-length) Set of Integer objects corresponding to the audio device types of devices supported by the implementation. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If an invalid direction constant is specified. |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#GET_DEVICES_OUTPUTS`
- `https://developer.android.com/reference/android/media/AudioManager#GET_DEVICES_INPUTS`

### getSupportedMixerAttributes

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<AudioMixerAttributes> getSupportedMixerAttributes (AudioDeviceInfo device)
```

Returns the `https://developer.android.com/reference/android/media/AudioMixerAttributes` that can be used to set as preferred mixer
attributes via `https://developer.android.com/reference/android/media/AudioManager#setPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo,%20android.media.AudioMixerAttributes)`.

Note that only USB devices are guaranteed to expose configurable mixer attributes. An
empty list may be returned for all other types of devices as they may not allow dynamic
configuration.

<br />

| Parameters ||
|---|---|
| `device` | `AudioDeviceInfo`: the device to query. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/AudioMixerAttributes>` | a list of `https://developer.android.com/reference/android/media/AudioMixerAttributes` that can be used as preferred mixer attributes for the given device. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#setPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo,%20android.media.AudioMixerAttributes)`

### getVibrateSetting

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getVibrateSetting (int vibrateType)
```


**This method was deprecated
in API level 16.**   

Applications should maintain their own vibrate policy based on
current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.

Returns whether the user's vibrate setting for a vibrate type.


This shouldn't be needed by most clients that want to vibrate, instead
see `https://developer.android.com/reference/android/media/AudioManager#shouldVibrate(int)`.

<br />

| Parameters ||
|---|---|
| `vibrateType` | `int`: The type of vibrate. One of `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_TYPE_NOTIFICATION` or `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_TYPE_RINGER`. <br /> |

| Returns ||
|---|---|
| `int` | The vibrate setting, one of `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_SETTING_ON`, `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_SETTING_OFF`, or `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_SETTING_ONLY_SILENT`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#setVibrateSetting(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#shouldVibrate(int)`

### getVolumeGroupIdForAttributes

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getVolumeGroupIdForAttributes (AudioAttributes attributes)
```

Returns the volume group id associated to the given `https://developer.android.com/reference/android/media/AudioAttributes`.

<br />

| Parameters ||
|---|---|
| `attributes` | `AudioAttributes`: The `https://developer.android.com/reference/android/media/AudioAttributes` to consider. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `int` | audio volume group id supporting the given `https://developer.android.com/reference/android/media/AudioAttributes` if found, `android.media.audiopolicy.AudioVolumeGroup.DEFAULT_VOLUME_GROUP` otherwise. <br /> |

### isBluetoothA2dpOn

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isBluetoothA2dpOn ()
```


**This method was deprecated
in API level 26.**   

Use `https://developer.android.com/reference/android/media/AudioManager#getDevices(int)` instead to list available audio devices.

Checks whether a Bluetooth A2DP audio peripheral is connected or not.

<br />

| Returns ||
|---|---|
| `boolean` | true if a Bluetooth A2DP peripheral is connected false if otherwise <br /> |

### isBluetoothScoAvailableOffCall

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isBluetoothScoAvailableOffCall ()
```


**This method was deprecated
in API level 37.**   

This method is no longer necessary, the framework always supports SCO off call

Indicates if current platform supports use of SCO for off call use cases.
Application wanted to use bluetooth SCO audio when the phone is not in call
must first call this method to make sure that the platform supports this
feature.

<br />

| Returns ||
|---|---|
| `boolean` | true if bluetooth SCO can be used for audio when not in call false otherwise <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#startBluetoothSco()`

### isBluetoothScoOn

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isBluetoothScoOn ()
```


**This method was deprecated
in API level 34.**   

Use `https://developer.android.com/reference/android/media/AudioManager#getCommunicationDevice()` instead.

Checks whether communications use Bluetooth SCO.

<br />

| Returns ||
|---|---|
| `boolean` | true if SCO is used for communications; false if otherwise <br /> |

### isCallScreeningModeSupported

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isCallScreeningModeSupported ()
```

Indicates if the platform supports a special call screening and call monitoring mode.


When this mode is supported, it is possible to perform call screening and monitoring
functions while other use cases like music or movie playback are active.


Use `https://developer.android.com/reference/android/media/AudioManager#setMode(int)` with mode `https://developer.android.com/reference/android/media/AudioManager#MODE_CALL_SCREENING` to place the platform in
call screening mode.


If call screening mode is not supported, setting mode to
MODE_CALL_SCREENING will be ignored and will not change current mode reported by
`https://developer.android.com/reference/android/media/AudioManager#getMode()`.

<br />

| Returns ||
|---|---|
| `boolean` | true if call screening mode is supported, false otherwise. <br /> |

### isHapticPlaybackSupported

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isHapticPlaybackSupported ()
```

Return if audio haptic coupled playback is supported or not.

<br />

| Returns ||
|---|---|
| `boolean` | whether audio haptic playback supported. <br /> |

### isMicrophoneMute

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isMicrophoneMute ()
```

Checks whether the microphone mute is on or off.

<br />

| Returns ||
|---|---|
| `boolean` | true if microphone is muted, false if it's not <br /> |

### isMusicActive

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isMusicActive ()
```

Checks whether any music is active.

<br />

| Returns ||
|---|---|
| `boolean` | true if any music tracks are active. <br /> |

### isOffloadedPlaybackSupported

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isOffloadedPlaybackSupported (AudioFormat format, 
                AudioAttributes attributes)
```

Returns whether offloaded playback of an audio format is supported on the device.

Offloaded playback is the feature where the decoding and playback of an audio stream
is not competing with other software resources. In general, it is supported by dedicated
hardware, such as audio DSPs.

Note that this query only provides information about the support of an audio format,
it does not indicate whether the resources necessary for the offloaded playback are
available at that instant.

<br />

| Parameters ||
|---|---|
| `format` | `AudioFormat`: the audio format (codec, sample rate, channels) being checked. This value cannot be `null`. <br /> |
| `attributes` | `AudioAttributes`: the `https://developer.android.com/reference/android/media/AudioAttributes` to be used for playback. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | true if the given audio format can be offloaded. <br /> |

### isRampingRingerEnabled

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isRampingRingerEnabled ()
```

Returns the current user setting for ramping ringer on incoming phone call ringtone.

<br />

| Returns ||
|---|---|
| `boolean` | true if the incoming phone call ringtone is configured to gradually increase its volume, false otherwise. <br /> |

### isSpeakerphoneOn

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isSpeakerphoneOn ()
```


**This method was deprecated
in API level 34.**   

Use `https://developer.android.com/reference/android/media/AudioManager#getCommunicationDevice()` instead.

Checks whether the speakerphone is on or off.

<br />

| Returns ||
|---|---|
| `boolean` | true if speakerphone is on, false if it's off <br /> |

### isStreamMute

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isStreamMute (int streamType)
```

Returns the current mute state for a particular stream.

<br />

| Parameters ||
|---|---|
| `streamType` | `int`: The stream to get mute state for. <br /> |

| Returns ||
|---|---|
| `boolean` | The mute state for the given stream. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)`

### isSurroundFormatEnabled

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isSurroundFormatEnabled (int audioFormat)
```

Gets whether a certain surround format is enabled or not.

<br />

| Parameters ||
|---|---|
| `audioFormat` | `int`: a surround format. Value is one of the following: - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_AC3` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_E_AC3` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DTS` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DTS_HD` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_AAC_LC` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DOLBY_TRUEHD` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_AC4` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_AC4_L4` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_E_AC3_JOC` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DOLBY_MAT` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_MPEGH_BL_L3` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_MPEGH_BL_L4` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_MPEGH_LC_L3` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_MPEGH_LC_L4` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DTS_UHD_P1` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DRA` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DTS_HD_MA` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DTS_UHD_P2` |

| Returns ||
|---|---|
| `boolean` | whether the required surround format is enabled <br /> |

### isVolumeFixed

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isVolumeFixed ()
```

Indicates if the device implements a fixed volume policy.

Some devices may not have volume control and may operate at a fixed volume,
and may not enable muting or changing the volume of audio streams.
This method will return true on such devices.

The following APIs have no effect when volume is fixed:

- `https://developer.android.com/reference/android/media/AudioManager#adjustVolume(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#adjustSuggestedStreamVolume(int,%20int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#setStreamVolume(int,%20int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#setRingerMode(int)`
- `https://developer.android.com/reference/android/media/AudioManager#setStreamSolo(int,%20boolean)`
- `https://developer.android.com/reference/android/media/AudioManager#setStreamMute(int,%20boolean)`

<br />

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### isVolumeGroupMuted

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isVolumeGroupMuted (int groupId)
```

Returns the current mute state for a particular volume group associated to the given id.

Call first in prior `https://developer.android.com/reference/android/media/AudioManager#getVolumeGroupIdForAttributes(android.media.AudioAttributes)` to retrieve
the volume group id supporting the given `https://developer.android.com/reference/android/media/AudioAttributes`.

<br />

| Parameters ||
|---|---|
| `groupId` | `int`: of the audio volume group to consider. <br /> |

| Returns ||
|---|---|
| `boolean` | The mute state for the given audio volume group id. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#adjustVolumeGroupVolume(int,%20int,%20int)`

### isWiredHeadsetOn

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isWiredHeadsetOn ()
```


**This method was deprecated
in API level 15.**   

Use `https://developer.android.com/reference/android/media/AudioManager#getDevices(int)` instead to list available audio devices.

Checks whether a wired headset is connected or not.

This is not a valid indication that audio playback is
actually over the wired headset as audio routing depends on other conditions.

<br />

| Returns ||
|---|---|
| `boolean` | true if a wired headset is connected. false if otherwise <br /> |

### loadSoundEffects

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void loadSoundEffects ()
```

Load Sound effects.
This method must be called when sound effects are enabled.

<br />

### playSoundEffect

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void playSoundEffect (int effectType)
```

Plays a sound effect (Key clicks, lid open/close...)

<br />

| Parameters ||
|---|---|
| `effectType` | `int`: The type of sound effect. NOTE: This version uses the UI settings to determine whether sounds are heard or not. Value is one of the following: - `https://developer.android.com/reference/android/media/AudioManager#FX_KEY_CLICK` - `https://developer.android.com/reference/android/media/AudioManager#FX_FOCUS_NAVIGATION_UP` - `https://developer.android.com/reference/android/media/AudioManager#FX_FOCUS_NAVIGATION_DOWN` - `https://developer.android.com/reference/android/media/AudioManager#FX_FOCUS_NAVIGATION_LEFT` - `https://developer.android.com/reference/android/media/AudioManager#FX_FOCUS_NAVIGATION_RIGHT` - `https://developer.android.com/reference/android/media/AudioManager#FX_KEYPRESS_STANDARD` - `https://developer.android.com/reference/android/media/AudioManager#FX_KEYPRESS_SPACEBAR` - `https://developer.android.com/reference/android/media/AudioManager#FX_KEYPRESS_DELETE` - `https://developer.android.com/reference/android/media/AudioManager#FX_KEYPRESS_RETURN` - `https://developer.android.com/reference/android/media/AudioManager#FX_KEYPRESS_INVALID` - `https://developer.android.com/reference/android/media/AudioManager#FX_BACK` |

### playSoundEffect

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void playSoundEffect (int effectType, 
                float volume)
```

Plays a sound effect (Key clicks, lid open/close...)

<br />

| Parameters ||
|---|---|
| `effectType` | `int`: The type of sound effect. Value is one of the following: - `https://developer.android.com/reference/android/media/AudioManager#FX_KEY_CLICK` - `https://developer.android.com/reference/android/media/AudioManager#FX_FOCUS_NAVIGATION_UP` - `https://developer.android.com/reference/android/media/AudioManager#FX_FOCUS_NAVIGATION_DOWN` - `https://developer.android.com/reference/android/media/AudioManager#FX_FOCUS_NAVIGATION_LEFT` - `https://developer.android.com/reference/android/media/AudioManager#FX_FOCUS_NAVIGATION_RIGHT` - `https://developer.android.com/reference/android/media/AudioManager#FX_KEYPRESS_STANDARD` - `https://developer.android.com/reference/android/media/AudioManager#FX_KEYPRESS_SPACEBAR` - `https://developer.android.com/reference/android/media/AudioManager#FX_KEYPRESS_DELETE` - `https://developer.android.com/reference/android/media/AudioManager#FX_KEYPRESS_RETURN` - `https://developer.android.com/reference/android/media/AudioManager#FX_KEYPRESS_INVALID` - `https://developer.android.com/reference/android/media/AudioManager#FX_BACK` |
| `volume` | `float`: Sound effect volume. The volume value is a raw scalar so UI controls should be scaled logarithmically. If a volume of -1 is specified, the AudioManager.STREAM_MUSIC stream volume minus 3dB will be used. NOTE: This version is for applications that have their own settings panel for enabling and controlling volume. <br /> |

### registerAudioDeviceCallback

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void registerAudioDeviceCallback (AudioDeviceCallback callback, 
                Handler handler)
```

Registers an `https://developer.android.com/reference/android/media/AudioDeviceCallback` object to receive notifications of changes
to the set of connected audio devices.

<br />

| Parameters ||
|---|---|
| `callback` | `AudioDeviceCallback`: The `https://developer.android.com/reference/android/media/AudioDeviceCallback` object to receive connect/disconnect notifications. <br /> |
| `handler` | `Handler`: Specifies the `https://developer.android.com/reference/android/os/Handler` object for the thread on which to execute the callback. If `null`, the `https://developer.android.com/reference/android/os/Handler` associated with the main `https://developer.android.com/reference/android/os/Looper` will be used. <br /> |

### registerAudioPlaybackCallback

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void registerAudioPlaybackCallback (AudioManager.AudioPlaybackCallback cb, 
                Handler handler)
```

Register a callback to be notified of audio playback changes through
`https://developer.android.com/reference/android/media/AudioManager.AudioPlaybackCallback`

<br />

| Parameters ||
|---|---|
| `cb` | `AudioManager.AudioPlaybackCallback`: non-null callback to register <br /> |
| `handler` | `Handler`: the `https://developer.android.com/reference/android/os/Handler` object for the thread on which to execute the callback. If `null`, the `https://developer.android.com/reference/android/os/Handler` associated with the main `https://developer.android.com/reference/android/os/Looper` will be used. <br /> |

### registerAudioRecordingCallback

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void registerAudioRecordingCallback (AudioManager.AudioRecordingCallback cb, 
                Handler handler)
```

Register a callback to be notified of audio recording changes through
`https://developer.android.com/reference/android/media/AudioManager.AudioRecordingCallback`

<br />

| Parameters ||
|---|---|
| `cb` | `AudioManager.AudioRecordingCallback`: non-null callback to register <br /> |
| `handler` | `Handler`: the `https://developer.android.com/reference/android/os/Handler` object for the thread on which to execute the callback. If `null`, the `https://developer.android.com/reference/android/os/Handler` associated with the main `https://developer.android.com/reference/android/os/Looper` will be used. <br /> |

### registerMediaButtonEventReceiver

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void registerMediaButtonEventReceiver (ComponentName eventReceiver)
```


**This method was deprecated
in API level 21.**   

Use `https://developer.android.com/reference/android/media/session/MediaSession#setMediaButtonReceiver(android.app.PendingIntent)` instead.

Register a component to be the sole receiver of MEDIA_BUTTON intents.

<br />

| Parameters ||
|---|---|
| `eventReceiver` | `ComponentName`: identifier of a `https://developer.android.com/reference/android/content/BroadcastReceiver` that will receive the media button intent. This broadcast receiver must be declared in the application manifest. The package of the component must match that of the context you're registering from. <br /> |

### registerMediaButtonEventReceiver

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void registerMediaButtonEventReceiver (PendingIntent eventReceiver)
```


**This method was deprecated
in API level 21.**   

Use `https://developer.android.com/reference/android/media/session/MediaSession#setMediaButtonReceiver(android.app.PendingIntent)` instead.

Register a component to be the sole receiver of MEDIA_BUTTON intents. This is like
`https://developer.android.com/reference/android/media/AudioManager#registerMediaButtonEventReceiver(android.content.ComponentName)`, but allows
the buttons to go to any PendingIntent. Note that you should only use this form if
you know you will continue running for the full time until unregistering the
PendingIntent.

<br />

| Parameters ||
|---|---|
| `eventReceiver` | `PendingIntent`: target that will receive media button intents. The PendingIntent will be sent an `https://developer.android.com/reference/android/content/Intent#ACTION_MEDIA_BUTTON` event when a media button action occurs, with `https://developer.android.com/reference/android/content/Intent#EXTRA_KEY_EVENT` added and holding the key code of the media button that was pressed. <br /> |

### registerRemoteControlClient

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void registerRemoteControlClient (RemoteControlClient rcClient)
```


**This method was deprecated
in API level 21.**   

Use `https://developer.android.com/reference/android/media/session/MediaSession` instead.

Registers the remote control client for providing information to display on the remote
controls.

<br />

| Parameters ||
|---|---|
| `rcClient` | `RemoteControlClient`: The remote control client from which remote controls will receive information to display. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/RemoteControlClient`

### registerRemoteController

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean registerRemoteController (RemoteController rctlr)
```


**This method was deprecated
in API level 21.**   

Use
`https://developer.android.com/reference/android/media/session/MediaSessionManager#addOnActiveSessionsChangedListener(android.media.session.MediaSessionManager.OnActiveSessionsChangedListener,%20android.content.ComponentName)`
and `https://developer.android.com/reference/android/media/session/MediaController` instead.

Registers a `https://developer.android.com/reference/android/media/RemoteController` instance for it to receive media
metadata updates and playback state information from applications using
`https://developer.android.com/reference/android/media/RemoteControlClient`, and control their playback.


Registration requires the `https://developer.android.com/reference/android/media/RemoteController.OnClientUpdateListener` listener to be
one of the enabled notification listeners (see
`https://developer.android.com/reference/android/service/notification/NotificationListenerService`).

<br />

| Parameters ||
|---|---|
| `rctlr` | `RemoteController`: the object to register. <br /> |

| Returns ||
|---|---|
| `boolean` | true if the `https://developer.android.com/reference/android/media/RemoteController` was successfully registered, false if an error occurred, due to an internal system error, or insufficient permissions. <br /> |

### removeOnCommunicationDeviceChangedListener

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeOnCommunicationDeviceChangedListener (AudioManager.OnCommunicationDeviceChangedListener listener)
```

Removes a previously added listener of changes to the communication audio device.
See `https://developer.android.com/reference/android/media/AudioManager#setCommunicationDevice(android.media.AudioDeviceInfo)`.

<br />

| Parameters ||
|---|---|
| `listener` | `AudioManager.OnCommunicationDeviceChangedListener`: This value cannot be `null`. <br /> |

### removeOnModeChangedListener

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeOnModeChangedListener (AudioManager.OnModeChangedListener listener)
```

Removes a previously added listener for changes to audio mode.
See `https://developer.android.com/reference/android/media/AudioManager#getMode()`

<br />

| Parameters ||
|---|---|
| `listener` | `AudioManager.OnModeChangedListener`: This value cannot be `null`. <br /> |

### removeOnPreferredMixerAttributesChangedListener

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeOnPreferredMixerAttributesChangedListener (AudioManager.OnPreferredMixerAttributesChangedListener listener)
```

Removes a previously added listener of changes to the preferred mixer attributes.

<br />

| Parameters ||
|---|---|
| `listener` | `AudioManager.OnPreferredMixerAttributesChangedListener`: the listener to be notified of changes in the preferred mixer attributes, which were added via `https://developer.android.com/reference/android/media/AudioManager#addOnPreferredMixerAttributesChangedListener(java.util.concurrent.Executor,%20android.media.AudioManager.OnPreferredMixerAttributesChangedListener)`. This value cannot be `null`. <br /> |

### requestAudioFocus

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int requestAudioFocus (AudioFocusRequest focusRequest)
```

Request audio focus.
See the `https://developer.android.com/reference/android/media/AudioFocusRequest` for information about the options available to configure
your request, and notification of focus gain and loss.

> [!NOTE]
> **Note:** If an app targets Android 15 (API level 35) or higher, it cannot request audio focus unless it's the top app or running a foreground service. This requirement is similar to the [requirements
> for audio playback](https://developer.android.com/media/media3/session/background-playback#service-declaration). If an app requests audio focus when it does not meet these requirements, the method returns `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_REQUEST_FAILED`.

<br />

<br />

| Parameters ||
|---|---|
| `focusRequest` | `AudioFocusRequest`: a `https://developer.android.com/reference/android/media/AudioFocusRequest` instance used to configure how focus is requested. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_REQUEST_FAILED`, `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_REQUEST_GRANTED` or `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_REQUEST_DELAYED`. Note that the return value is never `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_REQUEST_DELAYED` when focus is requested without building the `https://developer.android.com/reference/android/media/AudioFocusRequest` with `https://developer.android.com/reference/android/media/AudioFocusRequest.Builder#setAcceptsDelayedFocusGain(boolean)` set to `true`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if passed a null argument |

### requestAudioFocus

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int requestAudioFocus (AudioManager.OnAudioFocusChangeListener l, 
                int streamType, 
                int durationHint)
```


**This method was deprecated
in API level 26.**   

use `https://developer.android.com/reference/android/media/AudioManager#requestAudioFocus(android.media.AudioFocusRequest)`

Request audio focus.
Send a request to obtain the audio focus.

> [!NOTE]
> **Note:** If an app targets Android 15 (API level 35) or higher, it cannot request audio focus unless it's the top app or running a foreground service. This requirement is similar to the [requirements
> for audio playback](https://developer.android.com/media/media3/session/background-playback#service-declaration). If an app requests audio focus when it does not meet these requirements, the method returns `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_REQUEST_FAILED`.

<br />

<br />

| Parameters ||
|---|---|
| `l` | `AudioManager.OnAudioFocusChangeListener`: the listener to be notified of audio focus changes <br /> |
| `streamType` | `int`: the main audio stream type affected by the focus request <br /> |
| `durationHint` | `int`: use `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_GAIN_TRANSIENT` to indicate this focus request is temporary, and focus will be abandonned shortly. Examples of transient requests are for the playback of driving directions, or notifications sounds. Use `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK` to indicate also that it's ok for the previous focus owner to keep playing if it ducks its audio output. Alternatively use `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE` for a temporary request that benefits from the system not playing disruptive sounds like notifications, for usecases such as voice memo recording, or speech recognition. Use `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_GAIN` for a focus request of unknown duration such as the playback of a song or a video. <br /> |

| Returns ||
|---|---|
| `int` | `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_REQUEST_FAILED` or `https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_REQUEST_GRANTED` <br /> |

### setAllowedCapturePolicy

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setAllowedCapturePolicy (int capturePolicy)
```

Specifies whether the audio played by this app may or may not be captured by other apps or
the system.

The default is `https://developer.android.com/reference/android/media/AudioAttributes#ALLOW_CAPTURE_BY_ALL`.

There are multiple ways to set this policy:

- for each track independently, see `https://developer.android.com/reference/android/media/AudioAttributes.Builder#setAllowedCapturePolicy(int)`
- application-wide at runtime, with this method
- application-wide at build time, see `allowAudioPlaybackCapture` in the application manifest.

The most restrictive policy is always applied. See `https://developer.android.com/reference/android/media/AudioPlaybackCaptureConfiguration` for more details on which audio signals can be captured.

<br />

<br />

| Parameters ||
|---|---|
| `capturePolicy` | `int`: one of `https://developer.android.com/reference/android/media/AudioAttributes#ALLOW_CAPTURE_BY_ALL`, `https://developer.android.com/reference/android/media/AudioAttributes#ALLOW_CAPTURE_BY_SYSTEM`, `https://developer.android.com/reference/android/media/AudioAttributes#ALLOW_CAPTURE_BY_NONE`. Value is one of the following: - `https://developer.android.com/reference/android/media/AudioAttributes#ALLOW_CAPTURE_BY_ALL` - `https://developer.android.com/reference/android/media/AudioAttributes#ALLOW_CAPTURE_BY_SYSTEM` - `https://developer.android.com/reference/android/media/AudioAttributes#ALLOW_CAPTURE_BY_NONE` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/RuntimeException` | if the argument is not a valid value. |

### setBluetoothA2dpOn

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setBluetoothA2dpOn (boolean on)
```


**This method was deprecated
in API level 15.**   

Use `https://developer.android.com/reference/android/media/MediaRouter#selectRoute(int,%20android.media.MediaRouter.RouteInfo)` instead.

<br />

<br />

| Parameters ||
|---|---|
| `on` | `boolean` <br /> |

### setBluetoothScoOn

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setBluetoothScoOn (boolean on)
```


**This method was deprecated
in API level 37.**   

Use `https://developer.android.com/` instead.

Request use of Bluetooth SCO headset for communications.


This method should only be used by applications that replace the platform-wide
management of audio settings or the main telephony application.

This method has been a no-op for applications for several releases, and should
not be used by any clients.

<br />

| Parameters ||
|---|---|
| `on` | `boolean`: set <var translate="no">true</var> to use bluetooth SCO for communications; <var translate="no">false</var> to not use bluetooth SCO for communications <br /> |

### setCommunicationDevice

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean setCommunicationDevice (AudioDeviceInfo device)
```

Selects the audio device that should be used for communication use cases, for instance voice
or video calls. This method can be used by voice or video chat applications to select a
different audio device than the one selected by default by the platform.

The device selection is expressed as an `https://developer.android.com/reference/android/media/AudioDeviceInfo` among devices returned by
`https://developer.android.com/reference/android/media/AudioManager#getAvailableCommunicationDevices()`. Note that only devices in a sink role
(AKA output devices, see `https://developer.android.com/reference/android/media/AudioDeviceInfo#isSink()`) can be specified. The matching
source device is selected automatically by the platform.

The selection is active as long as the requesting application process lives, until
`https://developer.android.com/reference/android/media/AudioManager#clearCommunicationDevice()` is called or until the device is disconnected.
It is therefore important for applications to clear the request when a call ends or the
the requesting activity or service is stopped or destroyed.

In case of simultaneous requests by multiple applications the priority is given to the
application currently controlling the audio mode (see `https://developer.android.com/reference/android/media/AudioManager#setMode(int)`). This is the
latest application having selected mode `https://developer.android.com/reference/android/media/AudioManager#MODE_IN_COMMUNICATION` or mode
`https://developer.android.com/reference/android/media/AudioManager#MODE_IN_CALL`. Note that `MODE_IN_CALL` can only be selected by the main
telephony application with permission
`https://developer.android.com/reference/android/Manifest.permission#MODIFY_PHONE_STATE`.

If the requested devices is not currently available, the request will be rejected and
the method will return false.

This API replaces the following deprecated APIs:

- `https://developer.android.com/reference/android/media/AudioManager#startBluetoothSco()`
- `https://developer.android.com/reference/android/media/AudioManager#stopBluetoothSco()`
- `https://developer.android.com/reference/android/media/AudioManager#setSpeakerphoneOn(boolean)`

#### Example

The example below shows how to enable and disable speakerphone mode.

```
// Get an AudioManager instance
AudioManager audioManager = Context.getSystemService(AudioManager.class);
AudioDeviceInfo speakerDevice = null;
List devices = audioManager.getAvailableCommunicationDevices();
for (AudioDeviceInfo device : devices) {
    if (device.getType() == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER) {
        speakerDevice = device;
        break;
    }
}
if (speakerDevice != null) {
    // Turn speakerphone ON.
    boolean result = audioManager.setCommunicationDevice(speakerDevice);
    if (!result) {
        // Handle error.
    }
    // Turn speakerphone OFF.
    audioManager.clearCommunicationDevice();
}
```

<br />

<br />

| Parameters ||
|---|---|
| `device` | `AudioDeviceInfo`: the requested audio device. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if the request was accepted, `false` otherwise. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If an invalid device is specified. |

### setEncodedSurroundMode

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean setEncodedSurroundMode (int mode)
```

Sets the surround sound mode.


Requires `https://developer.android.com/reference/android/Manifest.permission#WRITE_SETTINGS`

<br />

| Parameters ||
|---|---|
| `mode` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/media/AudioManager#ENCODED_SURROUND_OUTPUT_UNKNOWN` - `https://developer.android.com/reference/android/media/AudioManager#ENCODED_SURROUND_OUTPUT_AUTO` - `https://developer.android.com/reference/android/media/AudioManager#ENCODED_SURROUND_OUTPUT_NEVER` - `https://developer.android.com/reference/android/media/AudioManager#ENCODED_SURROUND_OUTPUT_ALWAYS` - `https://developer.android.com/reference/android/media/AudioManager#ENCODED_SURROUND_OUTPUT_MANUAL` |

| Returns ||
|---|---|
| `boolean` | true if successful, otherwise false <br /> |

### setMicrophoneMute

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setMicrophoneMute (boolean on)
```

Sets the microphone mute on or off.


This method should only be used by applications that replace the platform-wide
management of audio settings or the main telephony application.

<br />

| Parameters ||
|---|---|
| `on` | `boolean`: set <var translate="no">true</var> to mute the microphone; <var translate="no">false</var> to turn mute off <br /> |

### setMode

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setMode (int mode)
```

Sets the audio mode.


The audio mode encompasses audio routing, volume management AND the behavior of
the telephony layer. Therefore this method should only be used by applications that
replace the platform-wide management of audio settings or the main telephony application.
In particular, the `https://developer.android.com/reference/android/media/AudioManager#MODE_IN_CALL` mode should only be used by the telephony
application when it places a phone call, as it will cause signals from the radio layer
to feed the platform mixer. The `https://developer.android.com/reference/android/media/AudioManager#MODE_ASSISTANT_CONVERSATION` should only be used
by applications that introduce an interactive assistant communication which would
prioritize the audio management around streams with `https://developer.android.com/reference/android/media/AudioAttributes#USAGE_ASSISTANT`.
To use `https://developer.android.com/reference/android/media/AudioManager#MODE_ASSISTANT_CONVERSATION`, the calling app must be allowed to manage
assistant audio (see `https://developer.android.com/reference/android/media/AudioManager#canManageAssistantAudio()`).

<br />

| Parameters ||
|---|---|
| `mode` | `int`: the requested audio mode. (see `https://developer.android.com/`) Informs the HAL about the current audio state so that it can route the audio appropriately. Value is one of the following: - `https://developer.android.com/reference/android/media/AudioManager#MODE_NORMAL` - `https://developer.android.com/reference/android/media/AudioManager#MODE_RINGTONE` - `https://developer.android.com/reference/android/media/AudioManager#MODE_IN_CALL` - `https://developer.android.com/reference/android/media/AudioManager#MODE_IN_COMMUNICATION` - `https://developer.android.com/reference/android/media/AudioManager#MODE_CALL_SCREENING` - `https://developer.android.com/reference/android/media/AudioManager#MODE_CALL_REDIRECT` - `https://developer.android.com/reference/android/media/AudioManager#MODE_COMMUNICATION_REDIRECT` - `https://developer.android.com/reference/android/media/AudioManager#MODE_ASSISTANT_CONVERSATION` |

### setParameters

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setParameters (String keyValuePairs)
```

Sets a variable number of parameter values to audio hardware.

<br />

| Parameters ||
|---|---|
| `keyValuePairs` | `String`: list of parameters key value pairs in the form: key1=value1;key2=value2;... <br /> |

### setPreferredMixerAttributes

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean setPreferredMixerAttributes (AudioAttributes attributes, 
                AudioDeviceInfo device, 
                AudioMixerAttributes mixerAttributes)
```

Configures the mixer attributes for a particular `https://developer.android.com/reference/android/media/AudioAttributes` over a given
`https://developer.android.com/reference/android/media/AudioDeviceInfo`.

Call `https://developer.android.com/reference/android/media/AudioManager#getSupportedMixerAttributes(android.media.AudioDeviceInfo)` to determine which mixer
attributes can be used with the given device.

The ownership of preferred mixer attributes is recognized by uid. When a playback from the
same uid is routed to the given audio device when calling this API, the output mixer/stream
will be configured with the values previously set via this API.

Use `https://developer.android.com/reference/android/media/AudioManager#clearPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo)`
to cancel setting mixer attributes for this `https://developer.android.com/reference/android/media/AudioAttributes`.


Requires `https://developer.android.com/reference/android/Manifest.permission#MODIFY_AUDIO_SETTINGS`

<br />

| Parameters ||
|---|---|
| `attributes` | `AudioAttributes`: the `https://developer.android.com/reference/android/media/AudioAttributes` whose mixer attributes should be set. Currently, only `https://developer.android.com/reference/android/media/AudioAttributes#USAGE_MEDIA` is supported. When playing audio targeted at the given device, use the same attributes for playback. This value cannot be `null`. <br /> |
| `device` | `AudioDeviceInfo`: the device to be routed. Currently, only USB device will be allowed. This value cannot be `null`. <br /> |
| `mixerAttributes` | `AudioMixerAttributes`: the preferred mixer attributes. When playing audio targeted at the given device, use the same `https://developer.android.com/reference/android/media/AudioFormat` for both playback and the mixer attributes. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | true only if the preferred mixer attributes are set successfully. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#getPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo)`
- `https://developer.android.com/reference/android/media/AudioManager#clearPreferredMixerAttributes(android.media.AudioAttributes,%20android.media.AudioDeviceInfo)`

### setRingerMode

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setRingerMode (int ringerMode)
```

Sets the ringer mode.


Silent mode will mute the volume and will not vibrate. Vibrate mode will
mute the volume and vibrate. Normal mode will be audible and may vibrate
according to user settings.

This method has no effect if the device implements a fixed volume policy
as indicated by `https://developer.android.com/reference/android/media/AudioManager#isVolumeFixed()`.
\*

From N onward, ringer mode adjustments that would toggle Do Not Disturb are not allowed
unless the app has been granted Notification Policy Access.
See `https://developer.android.com/reference/android/app/NotificationManager#isNotificationPolicyAccessGranted()`.

<br />

| Parameters ||
|---|---|
| `ringerMode` | `int`: The ringer mode, one of `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_NORMAL`, `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_SILENT`, or `https://developer.android.com/reference/android/media/AudioManager#RINGER_MODE_VIBRATE`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`
- `https://developer.android.com/reference/android/media/AudioManager#isVolumeFixed()`

### setRouting

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setRouting (int mode, 
                int routes, 
                int mask)
```


**This method was deprecated
in API level 15.**   

Do not set audio routing directly, use setSpeakerphoneOn(),
setBluetoothScoOn() methods instead.

Sets the audio routing for a specified mode

<br />

| Parameters ||
|---|---|
| `mode` | `int`: audio mode to change route. E.g., MODE_RINGTONE. <br /> |
| `routes` | `int`: bit vector of routes requested, created from one or more of ROUTE_xxx types. Set bits indicate that route should be on <br /> |
| `mask` | `int`: bit vector of routes to change, created from one or more of ROUTE_xxx types. Unset bits indicate the route should be left unchanged <br /> |

### setSpeakerphoneOn

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setSpeakerphoneOn (boolean on)
```


**This method was deprecated
in API level 34.**   

Use `https://developer.android.com/reference/android/media/AudioManager#setCommunicationDevice(android.media.AudioDeviceInfo)` or
`https://developer.android.com/reference/android/media/AudioManager#clearCommunicationDevice()` instead.

Sets the speakerphone on or off.


This method should only be used by applications that replace the platform-wide
management of audio settings or the main telephony application.

<br />

| Parameters ||
|---|---|
| `on` | `boolean`: set <var translate="no">true</var> to turn on speakerphone; <var translate="no">false</var> to turn it off <br /> |

### setStreamMute

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setStreamMute (int streamType, 
                boolean state)
```


**This method was deprecated
in API level 23.**   

Use `https://developer.android.com/reference/android/media/AudioManager#adjustStreamVolume(int,%20int,%20int)` with
`https://developer.android.com/reference/android/media/AudioManager#ADJUST_MUTE` or `https://developer.android.com/reference/android/media/AudioManager#ADJUST_UNMUTE` instead.

Mute or unmute an audio stream.


This method should only be used by applications that replace the
platform-wide management of audio settings or the main telephony
application.


This method has no effect if the device implements a fixed volume policy
as indicated by `https://developer.android.com/reference/android/media/AudioManager#isVolumeFixed()`.


This method was deprecated in API level 22. Prior to API level 22 this
method had significantly different behavior and should be used carefully.
The following applies only to pre-22 platforms:

- The mute command is protected against client process death: if a process with an active mute request on a stream dies, this stream will be unmuted automatically.
- The mute requests for a given stream are cumulative: the AudioManager can receive several mute requests from one or more clients and the stream will be unmuted only when the same number of unmute requests are received.
- For a better user experience, applications MUST unmute a muted stream in onPause() and mute is again in onResume() if appropriate.

<br />

<br />

| Parameters ||
|---|---|
| `streamType` | `int`: The stream to be muted/unmuted. <br /> |
| `state` | `boolean`: The required mute state: true for mute ON, false for mute OFF <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#isVolumeFixed()`

### setStreamSolo

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setStreamSolo (int streamType, 
                boolean state)
```


**This method was deprecated
in API level 23.**   

Do not use. If you need exclusive audio playback use
`https://developer.android.com/reference/android/media/AudioManager#requestAudioFocus(android.media.AudioFocusRequest)`.

Solo or unsolo a particular stream.


Do not use. This method has been deprecated and is now a no-op.
`https://developer.android.com/reference/android/media/AudioManager#requestAudioFocus(android.media.AudioFocusRequest)` should be used for exclusive audio playback.

<br />

| Parameters ||
|---|---|
| `streamType` | `int`: The stream to be soloed/unsoloed. <br /> |
| `state` | `boolean`: The required solo state: true for solo ON, false for solo OFF <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#isVolumeFixed()`

### setStreamVolume

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setStreamVolume (int streamType, 
                int index, 
                int flags)
```

Sets the volume index for a particular stream.

This method has no effect if the device implements a fixed volume policy
as indicated by `https://developer.android.com/reference/android/media/AudioManager#isVolumeFixed()`.

From N onward, volume adjustments that would toggle Do Not Disturb are not allowed unless
the app has been granted Notification Policy Access.
See `https://developer.android.com/reference/android/app/NotificationManager#isNotificationPolicyAccessGranted()`.

<br />

| Parameters ||
|---|---|
| `streamType` | `int`: The stream whose volume index should be set. <br /> |
| `index` | `int`: The volume index to set. See `https://developer.android.com/reference/android/media/AudioManager#getStreamMaxVolume(int)` for the largest valid value. <br /> |
| `flags` | `int`: Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/media/AudioManager#FLAG_SHOW_UI` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_ALLOW_RINGER_MODES` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_PLAY_SOUND` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_REMOVE_SOUND_AND_VIBRATE` - `https://developer.android.com/reference/android/media/AudioManager#FLAG_VIBRATE` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/SecurityException` | if the volume change triggers a Do Not Disturb change and the caller is not granted notification policy access. |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#getStreamMaxVolume(int)`
- `https://developer.android.com/reference/android/media/AudioManager#getStreamVolume(int)`
- `https://developer.android.com/reference/android/media/AudioManager#isVolumeFixed()`

### setSurroundFormatEnabled

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean setSurroundFormatEnabled (int audioFormat, 
                boolean enabled)
```

Sets and persists a certain surround format as enabled or not.


This API is called by TvSettings surround sound menu when user enables or disables a
surround sound format. This setting is persisted as global user setting.
Applications should revert their changes to surround sound settings unless they intend to
modify the global user settings across all apps. The framework does not auto-revert an
application's settings after a lifecycle event. Audio focus is not required to apply these
settings.


Requires `https://developer.android.com/reference/android/Manifest.permission#WRITE_SETTINGS`

<br />

| Parameters ||
|---|---|
| `audioFormat` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_AC3` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_E_AC3` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DTS` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DTS_HD` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_AAC_LC` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DOLBY_TRUEHD` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_AC4` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_AC4_L4` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_E_AC3_JOC` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DOLBY_MAT` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_MPEGH_BL_L3` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_MPEGH_BL_L4` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_MPEGH_LC_L3` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_MPEGH_LC_L4` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DTS_UHD_P1` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DRA` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DTS_HD_MA` - `https://developer.android.com/reference/android/media/AudioFormat#ENCODING_DTS_UHD_P2` |
| `enabled` | `boolean`: the required surround format state, true for enabled, false for disabled <br /> |

| Returns ||
|---|---|
| `boolean` | true if successful, otherwise false <br /> |

### setVibrateSetting

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setVibrateSetting (int vibrateType, 
                int vibrateSetting)
```


**This method was deprecated
in API level 16.**   

Applications should maintain their own vibrate policy based on
current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.

Sets the setting for when the vibrate type should vibrate.


This method should only be used by applications that replace the platform-wide
management of audio settings or the main telephony application.

<br />

| Parameters ||
|---|---|
| `vibrateType` | `int`: The type of vibrate. One of `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_TYPE_NOTIFICATION` or `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_TYPE_RINGER`. <br /> |
| `vibrateSetting` | `int`: The vibrate setting, one of `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_SETTING_ON`, `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_SETTING_OFF`, or `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_SETTING_ONLY_SILENT`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#getVibrateSetting(int)`
- `https://developer.android.com/reference/android/media/AudioManager#shouldVibrate(int)`

### setWiredHeadsetOn

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setWiredHeadsetOn (boolean on)
```


**This method was deprecated
in API level 15.**   

Do not use.

Sets audio routing to the wired headset on or off.

<br />

| Parameters ||
|---|---|
| `on` | `boolean`: set <var translate="no">true</var> to route audio to/from wired headset; <var translate="no">false</var> disable wired headset audio <br /> |

### shouldVibrate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean shouldVibrate (int vibrateType)
```


**This method was deprecated
in API level 16.**   

Applications should maintain their own vibrate policy based on
current ringer mode that can be queried via `https://developer.android.com/reference/android/media/AudioManager#getRingerMode()`.

Returns whether a particular type should vibrate according to user
settings and the current ringer mode.


This shouldn't be needed by most clients that use notifications to
vibrate. The notification manager will not vibrate if the policy doesn't
allow it, so the client should always set a vibrate pattern and let the
notification manager control whether or not to actually vibrate.

<br />

| Parameters ||
|---|---|
| `vibrateType` | `int`: The type of vibrate. One of `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_TYPE_NOTIFICATION` or `https://developer.android.com/reference/android/media/AudioManager#VIBRATE_TYPE_RINGER`. <br /> |

| Returns ||
|---|---|
| `boolean` | Whether the type should vibrate at the instant this method is called. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#setVibrateSetting(int,%20int)`
- `https://developer.android.com/reference/android/media/AudioManager#getVibrateSetting(int)`

### startBluetoothSco

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void startBluetoothSco ()
```


**This method was deprecated
in API level 34.**   

Use `https://developer.android.com/reference/android/media/AudioManager#setCommunicationDevice(android.media.AudioDeviceInfo)` instead.

Start bluetooth SCO audio connection.

Requires Permission:
`https://developer.android.com/reference/android/Manifest.permission#MODIFY_AUDIO_SETTINGS`.

This method can be used by applications wanting to send and received audio
to/from a bluetooth SCO headset while the phone is not in call.

As the SCO connection establishment can take several seconds,
applications should not rely on the connection to be available when the method
returns but instead register to receive the intent `https://developer.android.com/reference/android/media/AudioManager#ACTION_SCO_AUDIO_STATE_UPDATED`
and wait for the state to be `https://developer.android.com/reference/android/media/AudioManager#SCO_AUDIO_STATE_CONNECTED`.

As the ACTION_SCO_AUDIO_STATE_UPDATED intent is sticky, the application can check the SCO
audio state before calling startBluetoothSco() by reading the intent returned by the receiver
registration. If the state is already CONNECTED, no state change will be received via the
intent after calling startBluetoothSco(). It is however useful to call startBluetoothSco()
so that the connection stays active in case the current initiator stops the connection.

Unless the connection is already active as described above, the state will always
transition from DISCONNECTED to CONNECTING and then either to CONNECTED if the connection
succeeds or back to DISCONNECTED if the connection fails (e.g no headset is connected).

When finished with the SCO connection or if the establishment fails, the application must
call `https://developer.android.com/reference/android/media/AudioManager#stopBluetoothSco()` to clear the request and turn down the bluetooth connection.

Even if a SCO connection is established, the following restrictions apply on audio
output streams so that they can be routed to SCO headset:

- the stream type must be `https://developer.android.com/reference/android/media/AudioManager#STREAM_VOICE_CALL`
- the format must be mono
- the sampling must be 16kHz or 8kHz

The following restrictions apply on input streams:

- the format must be mono
- the sampling must be 8kHz

Note that the phone application always has the priority on the usage of the SCO
connection for telephony. If this method is called while the phone is in call
it will be ignored. Similarly, if a call is received or sent while an application
is using the SCO connection, the connection will be lost for the application and NOT
returned automatically when the call ends.

NOTE: up to and including API version
`https://developer.android.com/reference/android/os/Build.VERSION_CODES#JELLY_BEAN_MR1`, this method initiates a virtual
voice call to the bluetooth headset.
After API version `https://developer.android.com/reference/android/os/Build.VERSION_CODES#JELLY_BEAN_MR2` only a raw SCO audio
connection is established.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#stopBluetoothSco()`
- `https://developer.android.com/reference/android/media/AudioManager#ACTION_SCO_AUDIO_STATE_UPDATED`

### stopBluetoothSco

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void stopBluetoothSco ()
```


**This method was deprecated
in API level 34.**   

Use `https://developer.android.com/reference/android/media/AudioManager#clearCommunicationDevice()` instead.

Stop bluetooth SCO audio connection.

Requires Permission:
`https://developer.android.com/reference/android/Manifest.permission#MODIFY_AUDIO_SETTINGS`.

This method must be called by applications having requested the use of
bluetooth SCO audio with `https://developer.android.com/reference/android/media/AudioManager#startBluetoothSco()` when finished with the SCO
connection or if connection fails.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#startBluetoothSco()`

### unloadSoundEffects

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void unloadSoundEffects ()
```

Unload Sound effects.
This method can be called to free some memory when
sound effects are disabled.

<br />

### unregisterAudioDeviceCallback

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void unregisterAudioDeviceCallback (AudioDeviceCallback callback)
```

Unregisters an `https://developer.android.com/reference/android/media/AudioDeviceCallback` object which has been previously registered
to receive notifications of changes to the set of connected audio devices.

<br />

| Parameters ||
|---|---|
| `callback` | `AudioDeviceCallback`: The `https://developer.android.com/reference/android/media/AudioDeviceCallback` object that was previously registered with `https://developer.android.com/reference/android/media/AudioManager#registerAudioDeviceCallback(android.media.AudioDeviceCallback,%20android.os.Handler)` to be unregistered. <br /> |

### unregisterAudioPlaybackCallback

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void unregisterAudioPlaybackCallback (AudioManager.AudioPlaybackCallback cb)
```

Unregister an audio playback callback previously registered with
`https://developer.android.com/reference/android/media/AudioManager#registerAudioPlaybackCallback(android.media.AudioManager.AudioPlaybackCallback,%20android.os.Handler)`.

<br />

| Parameters ||
|---|---|
| `cb` | `AudioManager.AudioPlaybackCallback`: non-null callback to unregister <br /> |

### unregisterAudioRecordingCallback

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void unregisterAudioRecordingCallback (AudioManager.AudioRecordingCallback cb)
```

Unregister an audio recording callback previously registered with
`https://developer.android.com/reference/android/media/AudioManager#registerAudioRecordingCallback(android.media.AudioManager.AudioRecordingCallback,%20android.os.Handler)`.

<br />

| Parameters ||
|---|---|
| `cb` | `AudioManager.AudioRecordingCallback`: non-null callback to unregister <br /> |

### unregisterMediaButtonEventReceiver

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void unregisterMediaButtonEventReceiver (ComponentName eventReceiver)
```


**This method was deprecated
in API level 21.**   

Use `https://developer.android.com/reference/android/media/session/MediaSession` instead.

Unregister the receiver of MEDIA_BUTTON intents.

<br />

| Parameters ||
|---|---|
| `eventReceiver` | `ComponentName`: identifier of a `https://developer.android.com/reference/android/content/BroadcastReceiver` that was registered with `https://developer.android.com/reference/android/media/AudioManager#registerMediaButtonEventReceiver(android.content.ComponentName)`. <br /> |

### unregisterMediaButtonEventReceiver

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void unregisterMediaButtonEventReceiver (PendingIntent eventReceiver)
```


**This method was deprecated
in API level 21.**   

Use `https://developer.android.com/reference/android/media/session/MediaSession` instead.

Unregister the receiver of MEDIA_BUTTON intents.

<br />

| Parameters ||
|---|---|
| `eventReceiver` | `PendingIntent`: same PendingIntent that was registed with `https://developer.android.com/reference/android/media/AudioManager#registerMediaButtonEventReceiver(android.app.PendingIntent)`. <br /> |

### unregisterRemoteControlClient

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void unregisterRemoteControlClient (RemoteControlClient rcClient)
```


**This method was deprecated
in API level 21.**   

Use `https://developer.android.com/reference/android/media/session/MediaSession` instead.

Unregisters the remote control client that was providing information to display on the
remote controls.

<br />

| Parameters ||
|---|---|
| `rcClient` | `RemoteControlClient`: The remote control client to unregister. <br /> |

**See also:**

- `https://developer.android.com/reference/android/media/AudioManager#registerRemoteControlClient(android.media.RemoteControlClient)`

### unregisterRemoteController

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void unregisterRemoteController (RemoteController rctlr)
```


**This method was deprecated
in API level 21.**   

Use
`https://developer.android.com/reference/android/media/session/MediaSessionManager#removeOnActiveSessionsChangedListener(android.media.session.MediaSessionManager.OnActiveSessionsChangedListener)`
instead.

Unregisters a `https://developer.android.com/reference/android/media/RemoteController`, causing it to no longer receive
media metadata and playback state information, and no longer be capable
of controlling playback.

<br />

| Parameters ||
|---|---|
| `rctlr` | `RemoteController`: the object to unregister. <br /> |