Udostępnij za pośrednictwem


AudioManager.SetStreamVolume(Stream, Int32, VolumeNotificationFlags) Method

Definition

Sets the volume index for a particular stream.

[Android.Runtime.Register("setStreamVolume", "(III)V", "GetSetStreamVolume_IIIHandler")]
public virtual void SetStreamVolume (Android.Media.Stream streamType, int index, Android.Media.VolumeNotificationFlags flags);
[<Android.Runtime.Register("setStreamVolume", "(III)V", "GetSetStreamVolume_IIIHandler")>]
abstract member SetStreamVolume : Android.Media.Stream * int * Android.Media.VolumeNotificationFlags -> unit
override this.SetStreamVolume : Android.Media.Stream * int * Android.Media.VolumeNotificationFlags -> unit

Parameters

streamType
Stream

The stream whose volume index should be set.

index
Int32

The volume index to set. See #getStreamMaxVolume(int) for the largest valid value.

Attributes

Remarks

Sets the volume index for a particular stream.

This method has no effect if the device implements a fixed volume policy as indicated by #isVolumeFixed().

From N onward, volume adjustments that would toggle Do Not Disturb are not allowed unless the app has been granted Do Not Disturb Access. See NotificationManager#isNotificationPolicyAccessGranted().

Java documentation for android.media.AudioManager.setStreamVolume(int, int, int).

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.

Applies to

See also