AudioFocusRequestClass.Builder.SetAudioAttributes(AudioAttributes) Method

Definition

Sets the AudioAttributes to be associated with the focus request, and which describe the use case for which focus is requested.

[Android.Runtime.Register("setAudioAttributes", "(Landroid/media/AudioAttributes;)Landroid/media/AudioFocusRequest$Builder;", "", ApiSince=26)]
public Android.Media.AudioFocusRequestClass.Builder SetAudioAttributes(Android.Media.AudioAttributes attributes);
[<Android.Runtime.Register("setAudioAttributes", "(Landroid/media/AudioAttributes;)Landroid/media/AudioFocusRequest$Builder;", "", ApiSince=26)>]
member this.SetAudioAttributes : Android.Media.AudioAttributes -> Android.Media.AudioFocusRequestClass.Builder

Parameters

attributes
AudioAttributes

the AudioAttributes for the focus request. This value cannot be null.

Returns

this Builder instance. This value cannot be null.

Attributes

Remarks

Sets the AudioAttributes to be associated with the focus request, and which describe the use case for which focus is requested. As the focus requests typically precede audio playback, this information is used on certain platforms to declare the subsequent playback use case. It is therefore good practice to use in this method the same AudioAttributes as used for playback, see for example MediaPlayer.setAudioAttributes(AudioAttributes) in MediaPlayer or AudioTrack.Builder.setAudioAttributes(AudioAttributes) in AudioTrack.

Android reference for android.media.AudioFocusRequest.Builder.setAudioAttributes.

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