Language

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 the same audio attributes as used for playback, for example with SetAudioAttributes(AudioAttributes) or SetAudioAttributes(AudioAttributes).

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