AudioFocusRequestCompat

public class AudioFocusRequestCompat
extends Object

java.lang.Object
   ↳ androidx.media.AudioFocusRequestCompat


Compatibility version of an AudioFocusRequest.

Summary

Nested classes

class AudioFocusRequestCompat.Builder

Builder class for AudioFocusRequestCompat objects. 

Public methods

boolean equals(Object o)
AudioAttributesCompat getAudioAttributesCompat()

Gets the AudioAttributesCompat set for this AudioFocusRequestCompat, or the default attributes if none were set.

Handler getFocusChangeHandler()

Gets the Handler to be used for the focus change listener.

int getFocusGain()

Gets the type of audio focus request configured for this AudioFocusRequestCompat.

AudioManager.OnAudioFocusChangeListener getOnAudioFocusChangeListener()

Gets the focus change listener set for this AudioFocusRequestCompat.

int hashCode()
boolean willPauseWhenDucked()

Gets whether the application that would use this AudioFocusRequestCompat would pause when it is requested to duck.

Inherited methods

Public methods

equals

public boolean equals (Object o)

Parameters
o Object

Returns
boolean

getAudioAttributesCompat

public AudioAttributesCompat getAudioAttributesCompat ()

Gets the AudioAttributesCompat set for this AudioFocusRequestCompat, or the default attributes if none were set.

Returns
AudioAttributesCompat non-null AudioAttributesCompat.

getFocusChangeHandler

public Handler getFocusChangeHandler ()

Gets the Handler to be used for the focus change listener.

Returns
Handler the same Handler set in. AudioFocusRequestCompat.Builder.setOnAudioFocusChangeListener(OnAudioFocusChangeListener, Handler).

getFocusGain

public int getFocusGain ()

Gets the type of audio focus request configured for this AudioFocusRequestCompat.

Returns
int one of AudioManagerCompat.AUDIOFOCUS_GAIN, AudioManagerCompat.AUDIOFOCUS_GAIN_TRANSIENT, AudioManagerCompat.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK, and AudioManagerCompat.AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE.

getOnAudioFocusChangeListener

public AudioManager.OnAudioFocusChangeListener getOnAudioFocusChangeListener ()

Gets the focus change listener set for this AudioFocusRequestCompat.

Returns
AudioManager.OnAudioFocusChangeListener The AudioManager.OnAudioFocusChangeListener that was set.

hashCode

public int hashCode ()

Returns
int

willPauseWhenDucked

public boolean willPauseWhenDucked ()

Gets whether the application that would use this AudioFocusRequestCompat would pause when it is requested to duck. This value is only applicable on Build.VERSION_CODES.O and later.

Returns
boolean the duck/pause behavior.