AudioFocusRequestCompat


public class AudioFocusRequestCompat


Compatibility version of an AudioFocusRequest.

Summary

Nested types

Builder class for AudioFocusRequestCompat objects.

Public methods

boolean
@NonNull AudioAttributesCompat

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

@NonNull Handler

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

int

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

@NonNull AudioManager.OnAudioFocusChangeListener

Gets the focus change listener set for this AudioFocusRequestCompat.

int
boolean

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

Public methods

equals

public boolean equals(Object o)

getAudioAttributesCompat

Added in 1.1.0
public @NonNull AudioAttributesCompat getAudioAttributesCompat()

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

getFocusChangeHandler

Added in 1.1.0
public @NonNull Handler getFocusChangeHandler()

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

Returns
@NonNull Handler

the same Handler set in. setOnAudioFocusChangeListener.

getFocusGain

Added in 1.1.0
public int getFocusGain()

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

getOnAudioFocusChangeListener

Added in 1.1.0
public @NonNull AudioManager.OnAudioFocusChangeListener getOnAudioFocusChangeListener()

Gets the focus change listener set for this AudioFocusRequestCompat.

hashCode

public int hashCode()

willPauseWhenDucked

Added in 1.1.0
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 O and later.

Returns
boolean

the duck/pause behavior.