AudioManager class

Mixed-in types

Constructors

AudioManager.new()

Properties

channel MethodChannel
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

adjustMasterVolume(int steps, int flags) Future
Adjusts the master volume for the device's audio amplifier.
adjustStreamVolume(int streamType, int direction, int flags) Future<void>
Adjusts the volume of a particular stream by one step in a direction.
adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags) Future
Adjusts the volume of the most relevant stream, or the given fallback stream.
adjustVolume(int direction, int flags) Future
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.
getStreamMaxVolume(int streamType) Future<int>
Returns the maximum volume index for a particular stream.
getStreamMinVolume(int streamType) Future<int>
getStreamVolume(int streamType) Future<int>
Returns the current volume index for a particular stream.
init() → dynamic
inherited
invokeMethod<T>(String method, [dynamic arguments]) Future<T?>
inherited
isMusicActive() Future<bool>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onMethodCall(MethodCall call) Future
inherited
registerMethodCallListener(String key, MethodCallListener listener) → void
inherited
setMasterVolume(int index, int flags) Future
Returns the current ringtone mode.
setStreamMute(int streamType, bool state) Future
Mute or unmute an audio stream.
setStreamSolo(int streamType, bool state) Future
Solo or unsolo a particular stream. All other streams are muted.
setStreamVolume(int streamType, int value) Future
toString() String
A string representation of this object.
inherited
unregisterMethodCallListener(String name) → void
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

isValidRingerMode(int ringerMode) bool
Checks valid ringer mode values.

Constants

ACTION_AUDIO_BECOMING_NOISY → const String
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.
ACTION_HDMI_AUDIO_PLUG → const String
Broadcast Action: A sticky broadcast indicating an HDMI cable was plugged or unplugged.
ACTION_HEADSET_PLUG → const String
Broadcast Action: Wired Headset plugged in or unplugged.
ADJUST_LOWER → const int
Decrease the ringer volume.
ADJUST_RAISE → const int
Increase the ringer volume.
ADJUST_SAME → const int
Maintain the previous ringer volume. This may be useful when needing to show the volume toast without actually modifying the volume.
EXTRA_AUDIO_PLUG_STATE → const String
Extra used in {@link #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.
EXTRA_ENCODINGS → const String
Extra used in {@link #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 {@link #EXTRA_AUDIO_PLUG_STATE}). Encoding values are defined in {@link AudioFormat} (for instance see {@link AudioFormat#ENCODING_PCM_16BIT}). Use {@link android.content.Intent#getIntArrayExtra(String)} to retrieve the encoding values.
EXTRA_MASTER_VOLUME_MUTED → const String
@hide The new master volume mute state for the master mute changed intent. Value is boolean
EXTRA_MAX_CHANNEL_COUNT → const String
Extra used in {@link #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 {@link #EXTRA_AUDIO_PLUG_STATE}).
EXTRA_PREV_VOLUME_STREAM_DEVICES → const String
@hide The previous devices associated with the stream for the stream devices changed intent.
EXTRA_PREV_VOLUME_STREAM_VALUE → const String
@hide The previous volume associated with the stream for the volume changed intent.
EXTRA_RINGER_MODE → const String
The new ringer mode.
EXTRA_STREAM_VOLUME_MUTED → const String
@hide The new stream volume mute state for the stream mute changed intent. Value is boolean
EXTRA_VIBRATE_SETTING → const String
The new vibrate setting for a particular type.
EXTRA_VIBRATE_TYPE → const String
The vibrate type whose setting has changed.
EXTRA_VOLUME_STREAM_DEVICES → const String
@hide The devices associated with the stream for the stream devices changed intent.
EXTRA_VOLUME_STREAM_TYPE → const String
@hide The stream type for the volume changed intent.
EXTRA_VOLUME_STREAM_TYPE_ALIAS → const String
@hide The stream type alias for the volume changed intent. For instance the intent may indicate a change of the {@link #STREAM_NOTIFICATION} stream type (as indicated by the {@link #EXTRA_VOLUME_STREAM_TYPE} extra), but this is also reflected by a change of the volume of its alias, {@link #STREAM_RING} on some devices, {@link #STREAM_MUSIC} on others (e.g. a television).
EXTRA_VOLUME_STREAM_VALUE → const String
@hide The volume associated with the stream for the volume changed intent.
FLAG_ACTIVE_MEDIA_ONLY → const int
Indicates that this should only be handled if media is actively playing. @hide
FLAG_ALLOW_RINGER_MODES → const int
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 {@link #ADJUST_LOWER}, then the ringer mode may switch the silent or vibrate mode.
FLAG_BLUETOOTH_ABS_VOLUME → const int
Indicates the volume set/adjust call is for Bluetooth absolute volume @hide
FLAG_FIXED_VOLUME → const int
Indicates to VolumePanel that the volume slider should be disabled as user cannot change the stream volume @hide
FLAG_FROM_KEY → const int
Adjusting the volume due to a hardware key press. @hide
FLAG_HDMI_SYSTEM_AUDIO_VOLUME → const int
Indicates the volume call is for Hdmi Cec system audio volume @hide
FLAG_PLAY_SOUND → const int
Whether to play a sound when changing the volume.
FLAG_REMOVE_SOUND_AND_VIBRATE → const int
Removes any sounds/vibrate that may be in the queue, or are playing (related to changing volume).
FLAG_SHOW_SILENT_HINT → const int
Adjusting the volume was prevented due to silent mode, display a hint in the UI. @hide
FLAG_SHOW_UI → const int
Show a toast containing the current volume.
FLAG_SHOW_UI_WARNINGS → const int
Like FLAG_SHOW_UI, but only dialog warnings and confirmations, no sliders. @hide
FLAG_SHOW_VIBRATE_HINT → const int
Adjusting the volume down from vibrated was prevented, display a hint in the UI. @hide
FLAG_VIBRATE → const int
Whether to vibrate if going into the vibrate ringer mode.
INTERNAL_RINGER_MODE_CHANGED_ACTION → const String
@hide Sticky broadcast intent action indicating that the internal ringer mode has changed. Includes the new ringer mode.
MASTER_MUTE_CHANGED_ACTION → const String
@hide Broadcast intent when the master mute state changes. Includes the the new volume
RINGER_MODE_CHANGED_ACTION → const String
Sticky broadcast intent action indicating that the ringer mode has changed. Includes the new ringer mode.
RINGER_MODE_MAX → const int
RINGER_MODE_NORMAL → const int
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.
RINGER_MODE_SILENT → const int
Ringer mode that will be silent and will not vibrate. (This overrides the vibrate setting.)
RINGER_MODE_VIBRATE → const int
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.)
STREAM_ACCESSIBILITY → const int
Used to identify the volume of audio streams for accessibility prompts */
STREAM_ALARM → const int
The audio stream for alarms */
STREAM_BLUETOOTH_SCO → const int
@hide The audio stream for phone calls when connected to bluetooth */
STREAM_DEVICES_CHANGED_ACTION → const String
@hide Broadcast intent when the devices for a particular stream type changes. Includes the stream, the new devices and previous devices. Notes:
STREAM_DTMF → const int
The audio stream for DTMF Tones */
STREAM_MUSIC → const int
The audio stream for music playback */
STREAM_MUTE_CHANGED_ACTION → const String
@hide Broadcast intent when a stream mute state changes. Includes the stream that changed and the new mute state
STREAM_NOTIFICATION → const int
The audio stream for notifications */
STREAM_RING → const int
The audio stream for the phone ring */
STREAM_SYSTEM → const int
The audio stream for system sounds */
STREAM_SYSTEM_ENFORCED → const int
@hide The audio stream for enforced system sounds in certain countries (e.g camera in Japan) */
STREAM_TTS → const int
@hide The audio stream for text to speech (TTS) */
STREAM_VOICE_CALL → const int
The audio stream for phone calls */
USE_DEFAULT_STREAM_TYPE → const int
Suggests using the default stream type. This may not be used in all places a stream type is needed.
VIBRATE_SETTING_CHANGED_ACTION → const String
Broadcast intent action indicating that the vibrate setting has changed. Includes the vibrate type and its new setting.
VIBRATE_SETTING_OFF → const int
Vibrate setting that suggests to never vibrate.
VIBRATE_SETTING_ON → const int
Vibrate setting that suggests to vibrate when possible.
VIBRATE_SETTING_ONLY_SILENT → const int
Vibrate setting that suggests to only vibrate when in the vibrate ringer mode.
VIBRATE_TYPE_NOTIFICATION → const int
Vibrate type that corresponds to notifications.
VIBRATE_TYPE_RINGER → const int
Vibrate type that corresponds to the ringer.
VOLUME_CHANGED_ACTION → const String
@hide Broadcast intent when the volume for a particular stream type changes. Includes the stream, the new volume and previous volumes. Notes: