AudioManager AudioManager Class

Definition

AudioManager provides access to volume and ringer mode control.

[Android.Runtime.Register("android/media/AudioManager", ApiSince=1, DoNotGenerateAcw=true)]
public class AudioManager : Java.Lang.Object
type AudioManager = class
    inherit Object
Inheritance
AudioManagerAudioManager
Attributes

Remarks

Android platform documentation

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

AudioManager(IntPtr, JniHandleOwnership) AudioManager(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

ActionAudioBecomingNoisy ActionAudioBecomingNoisy

Broadcast intent, a hint for applications that audio is about to become 'noisy' due to a change in audio outputs.

ActionHdmiAudioPlug ActionHdmiAudioPlug

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

ActionHeadsetPlug ActionHeadsetPlug

Broadcast Action: Wired Headset plugged in or unplugged.

ActionScoAudioStateChanged ActionScoAudioStateChanged

Sticky broadcast intent action indicating that the bluetoooth SCO audio connection state has changed.

ActionScoAudioStateUpdated ActionScoAudioStateUpdated

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

AudiofocusGain AudiofocusGain

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

AudiofocusGainTransient AudiofocusGainTransient

Used to indicate a temporary gain or request of audio focus, anticipated to last a short amount of time.

AudiofocusGainTransientExclusive AudiofocusGainTransientExclusive

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.

AudiofocusGainTransientMayDuck AudiofocusGainTransientMayDuck
AudiofocusLoss AudiofocusLoss

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

AudiofocusLossTransient AudiofocusLossTransient

Used to indicate a transient loss of audio focus.

AudiofocusLossTransientCanDuck AudiofocusLossTransientCanDuck
AudiofocusNone AudiofocusNone
AudiofocusRequestDelayed AudiofocusRequestDelayed
AudiofocusRequestFailed AudiofocusRequestFailed

A failed focus change request.

AudiofocusRequestGranted AudiofocusRequestGranted

A successful focus change request.

AudioSessionIdGenerate AudioSessionIdGenerate

A special audio session ID to indicate that the audio session ID isn't known and the framework should generate a new value.

Error Error

A default error code.

ErrorDeadObject ErrorDeadObject

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

ExtraAudioPlugState ExtraAudioPlugState

Extra used in ActionHdmiAudioPlug to communicate whether HDMI is plugged in or unplugged.

ExtraEncodings ExtraEncodings

Extra used in ActionHdmiAudioPlug to define the audio encodings supported by the connected HDMI device.

ExtraMaxChannelCount ExtraMaxChannelCount

Extra used in ActionHdmiAudioPlug to define the maximum number of channels supported by the HDMI device.

ExtraRingerMode ExtraRingerMode

The new ringer mode.

ExtraScoAudioPreviousState ExtraScoAudioPreviousState

Extra for intent ActionScoAudioStateUpdated containing the previous bluetooth SCO connection state.

ExtraScoAudioState ExtraScoAudioState

Extra for intent ActionScoAudioStateChanged or ActionScoAudioStateUpdated containing the new bluetooth SCO connection state.

ExtraVibrateSetting ExtraVibrateSetting

The new vibrate setting for a particular type.

ExtraVibrateType ExtraVibrateType

The vibrate type whose setting has changed.

NumStreams NumStreams
PropertyOutputFramesPerBuffer PropertyOutputFramesPerBuffer

Used as a key for GetProperty(String) to request the native or optimal output buffer size for this device's primary output stream, in decimal PCM frames.

PropertyOutputSampleRate PropertyOutputSampleRate

Used as a key for GetProperty(String) to request the native or optimal output sample rate for this device's primary output stream, in decimal Hz.

PropertySupportAudioSourceUnprocessed PropertySupportAudioSourceUnprocessed
PropertySupportMicNearUltrasound PropertySupportMicNearUltrasound
PropertySupportSpeakerNearUltrasound PropertySupportSpeakerNearUltrasound
RingerModeChangedAction RingerModeChangedAction

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

ScoAudioStateConnected ScoAudioStateConnected

Value for extra ExtraScoAudioState or ExtraScoAudioPreviousState indicating that the SCO audio channel is established

ScoAudioStateConnecting ScoAudioStateConnecting

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

ScoAudioStateDisconnected ScoAudioStateDisconnected

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

ScoAudioStateError ScoAudioStateError

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

StreamAccessibility StreamAccessibility
UseDefaultStreamType UseDefaultStreamType

Suggests using the default stream type.

VibrateSettingChangedAction VibrateSettingChangedAction

Broadcast intent action indicating that the vibrate setting has changed.

Properties

ActivePlaybackConfigurations ActivePlaybackConfigurations
ActiveRecordingConfigurations ActiveRecordingConfigurations
BluetoothA2dpOn BluetoothA2dpOn

Checks whether A2DP audio routing to the Bluetooth headset is on or off.

BluetoothScoOn BluetoothScoOn

Checks whether communications use Bluetooth SCO.

Class Class

Returns the unique instance of Class that represents this object's class.

(Inherited from Object)
Handle Handle

The handle to the underlying Android instance.

(Inherited from Object)
IJavaObjectEx.IsProxy IJavaObjectEx.IsProxy Inherited from Object
IJavaObjectEx.KeyHandle IJavaObjectEx.KeyHandle Inherited from Object
IJavaObjectEx.NeedsActivation IJavaObjectEx.NeedsActivation Inherited from Object
IJavaPeerable.JniManagedPeerState IJavaPeerable.JniManagedPeerState Inherited from Object
IsBluetoothScoAvailableOffCall IsBluetoothScoAvailableOffCall

Indicates if current platform supports use of SCO for off call use cases.

IsMusicActive IsMusicActive

Checks whether any music is active.

IsVolumeFixed IsVolumeFixed

Indicates if the device implements a fixed volume policy.

JniIdentityHashCode JniIdentityHashCode Inherited from Object
JniPeerMembers JniPeerMembers
MicrophoneMute MicrophoneMute

Checks whether the microphone mute is on or off.

Mode Mode

Returns the current audio mode.

PeerReference PeerReference Inherited from Object
RingerMode RingerMode

Returns the current ringtone mode.

SpeakerphoneOn SpeakerphoneOn

Checks whether the speakerphone is on or off.

ThresholdClass ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

WiredHeadsetOn WiredHeadsetOn

Checks whether a wired headset is connected or not.

Methods

AbandonAudioFocus(AudioManager+IOnAudioFocusChangeListener) AbandonAudioFocus(AudioManager+IOnAudioFocusChangeListener)

Abandon audio focus.

AbandonAudioFocusRequest(AudioFocusRequestClass) AbandonAudioFocusRequest(AudioFocusRequestClass)
AdjustStreamVolume(Stream, Adjust, VolumeNotificationFlags) AdjustStreamVolume(Stream, Adjust, VolumeNotificationFlags)

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

AdjustSuggestedStreamVolume(Adjust, Stream, VolumeNotificationFlags) AdjustSuggestedStreamVolume(Adjust, Stream, VolumeNotificationFlags)

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

AdjustVolume(Adjust, VolumeNotificationFlags) AdjustVolume(Adjust, VolumeNotificationFlags)

Adjusts the volume of the most relevant stream.

Clone() Clone()

Creates and returns a copy of this Object.

(Inherited from Object)
DispatchMediaKeyEvent(KeyEvent) DispatchMediaKeyEvent(KeyEvent)

Sends a simulated key event for a media button.

Dispose() Dispose() Inherited from Object
Dispose(Boolean) Dispose(Boolean) Inherited from Object
Equals(Object) Equals(Object)

Compares this instance with the specified object and indicates if they are equal.

(Inherited from Object)
FromContext(Context) FromContext(Context)
GenerateAudioSessionId() GenerateAudioSessionId()

Return a new audio session identifier not associated with any player or effect.

GetDevices(GetDevicesTargets) GetDevices(GetDevicesTargets)
GetHashCode() GetHashCode()

Returns an integer hash code for this object.

(Inherited from Object)
GetParameters(String) GetParameters(String)

Gets a variable number of parameter values from audio hardware.

GetProperty(String) GetProperty(String)

Returns the value of the property with the specified key.

GetRouting(Mode) GetRouting(Mode)

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

GetStreamMaxVolume(Stream) GetStreamMaxVolume(Stream)

Returns the maximum volume index for a particular stream.

GetStreamVolume(Stream) GetStreamVolume(Stream)

Returns the current volume index for a particular stream.

GetVibrateSetting(VibrateType) GetVibrateSetting(VibrateType)

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

IsStreamMute(Stream) IsStreamMute(Stream)
JavaFinalize() JavaFinalize()

Invoked when the garbage collector has detected that this instance is no longer reachable.

(Inherited from Object)
LoadSoundEffects() LoadSoundEffects()

Load Sound effects.

LoadSoundEffectsAsync() LoadSoundEffectsAsync()
Notify() Notify()

Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
NotifyAll() NotifyAll()

Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
PlaySoundEffect(SoundEffect) PlaySoundEffect(SoundEffect)

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

PlaySoundEffect(SoundEffect, Single) PlaySoundEffect(SoundEffect, Single)

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

RegisterAudioDeviceCallback(AudioDeviceCallback, Handler) RegisterAudioDeviceCallback(AudioDeviceCallback, Handler)
RegisterAudioPlaybackCallback(AudioManager+AudioPlaybackCallback, Handler) RegisterAudioPlaybackCallback(AudioManager+AudioPlaybackCallback, Handler)
RegisterAudioRecordingCallback(AudioManager+AudioRecordingCallback, Handler) RegisterAudioRecordingCallback(AudioManager+AudioRecordingCallback, Handler)
RegisterMediaButtonEventReceiver(ComponentName) RegisterMediaButtonEventReceiver(ComponentName)

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

RegisterMediaButtonEventReceiver(PendingIntent) RegisterMediaButtonEventReceiver(PendingIntent)

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

RegisterRemoteControlClient(RemoteControlClient) RegisterRemoteControlClient(RemoteControlClient)

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

RegisterRemoteController(RemoteController) RegisterRemoteController(RemoteController)

Registers a RemoteController instance for it to receive media metadata updates and playback state information from applications using RemoteControlClient, and control their playback.

RequestAudioFocus(AudioFocusRequestClass) RequestAudioFocus(AudioFocusRequestClass)
RequestAudioFocus(AudioManager+IOnAudioFocusChangeListener, Stream, AudioFocus) RequestAudioFocus(AudioManager+IOnAudioFocusChangeListener, Stream, AudioFocus)

Request audio focus.

SetHandle(IntPtr, JniHandleOwnership) SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetParameters(String) SetParameters(String)

Sets a variable number of parameter values to audio hardware.

SetRouting(Mode, Route, Route) SetRouting(Mode, Route, Route)

Sets the audio routing for a specified mode

SetStreamMute(Stream, Boolean) SetStreamMute(Stream, Boolean)

Mute or unmute an audio stream.

SetStreamSolo(Stream, Boolean) SetStreamSolo(Stream, Boolean)

Solo or unsolo a particular stream.

SetStreamVolume(Stream, Int32, VolumeNotificationFlags) SetStreamVolume(Stream, Int32, VolumeNotificationFlags)

Sets the volume index for a particular stream.

SetVibrateSetting(VibrateType, VibrateSetting) SetVibrateSetting(VibrateType, VibrateSetting)

Sets the setting for when the vibrate type should vibrate.

ShouldVibrate(VibrateType) ShouldVibrate(VibrateType)

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

StartBluetoothSco() StartBluetoothSco()

Start bluetooth SCO audio connection.

StopBluetoothSco() StopBluetoothSco()

Stop bluetooth SCO audio connection.

ToArray<T>() ToArray<T>() Inherited from Object
ToString() ToString()

Returns a string containing a concise, human-readable description of this object.

(Inherited from Object)
UnloadSoundEffects() UnloadSoundEffects()

Unload Sound effects.

UnregisterAudioDeviceCallback(AudioDeviceCallback) UnregisterAudioDeviceCallback(AudioDeviceCallback)
UnregisterAudioPlaybackCallback(AudioManager+AudioPlaybackCallback) UnregisterAudioPlaybackCallback(AudioManager+AudioPlaybackCallback)
UnregisterAudioRecordingCallback(AudioManager+AudioRecordingCallback) UnregisterAudioRecordingCallback(AudioManager+AudioRecordingCallback)
UnregisterFromRuntime() UnregisterFromRuntime() Inherited from Object
UnregisterMediaButtonEventReceiver(ComponentName) UnregisterMediaButtonEventReceiver(ComponentName)

Unregister the receiver of MEDIA_BUTTON intents.

UnregisterMediaButtonEventReceiver(PendingIntent) UnregisterMediaButtonEventReceiver(PendingIntent)

Unregister the receiver of MEDIA_BUTTON intents.

UnregisterRemoteControlClient(RemoteControlClient) UnregisterRemoteControlClient(RemoteControlClient)

Unregisters the remote control client that was providing information to display on the remote controls.

UnregisterRemoteController(RemoteController) UnregisterRemoteController(RemoteController)

Unregisters a RemoteController, causing it to no longer receive media metadata and playback state information, and no longer be capable of controlling playback.

Wait() Wait()

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

(Inherited from Object)
Wait(Int64) Wait(Int64)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)
Wait(Int64, Int32) Wait(Int64, Int32)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)

Explicit Interface Implementations

IJavaObjectEx.ToLocalJniHandle() IJavaObjectEx.ToLocalJniHandle() Inherited from Object
IJavaPeerable.Disposed() IJavaPeerable.Disposed() Inherited from Object
IJavaPeerable.DisposeUnlessReferenced() IJavaPeerable.DisposeUnlessReferenced() Inherited from Object
IJavaPeerable.Finalized() IJavaPeerable.Finalized() Inherited from Object
IJavaPeerable.SetJniIdentityHashCode(Int32) IJavaPeerable.SetJniIdentityHashCode(Int32) Inherited from Object
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) Inherited from Object
IJavaPeerable.SetPeerReference(JniObjectReference) IJavaPeerable.SetPeerReference(JniObjectReference) Inherited from Object

Extension Methods

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable) GetJniTypeName(IJavaPeerable)

Applies to