AudioManager.IOnAudioFocusChangeListener.OnAudioFocusChange Method

Definition

Called on the listener to notify it the audio focus for this listener has been changed.

[Android.Runtime.Register("onAudioFocusChange", "(I)V", "GetOnAudioFocusChange_IHandler:Android.Media.AudioManager/IOnAudioFocusChangeListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void OnAudioFocusChange (Android.Media.AudioFocus focusChange);
[<Android.Runtime.Register("onAudioFocusChange", "(I)V", "GetOnAudioFocusChange_IHandler:Android.Media.AudioManager/IOnAudioFocusChangeListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member OnAudioFocusChange : Android.Media.AudioFocus -> unit

Parameters

focusChange
AudioFocus

the type of focus change, one of AudioManager#AUDIOFOCUS_GAIN, AudioManager#AUDIOFOCUS_LOSS, AudioManager#AUDIOFOCUS_LOSS_TRANSIENT and AudioManager#AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK.

Attributes

Remarks

Called on the listener to notify it the audio focus for this listener has been changed. The focusChange value indicates whether the focus was gained, whether the focus was lost, and whether that loss is transient, or whether the new focus holder will hold it for an unknown amount of time. When losing focus, listeners can use the focus change information to decide what behavior to adopt when losing focus. A music player could for instance elect to lower the volume of its music stream (duck) for transient focus losses, and pause otherwise.

Java documentation for android.media.AudioManager.OnAudioFocusChangeListener.onAudioFocusChange(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