Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

AudioFocusRequestCompat

open class AudioFocusRequestCompat
kotlin.Any
   ↳ androidx.media.AudioFocusRequestCompat

Compatibility version of an AudioFocusRequest.

Summary

Nested classes

Builder class for AudioFocusRequestCompat objects.

Public methods
open Int

open Boolean
equals(other: Any?)

open OnAudioFocusChangeListener

Gets the focus change listener set for this AudioFocusRequestCompat.

open Handler

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

open Int

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

open Boolean

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

open AudioAttributesCompat

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

Public methods

hashCode

open fun hashCode(): Int

equals

open fun equals(other: Any?): Boolean

getOnAudioFocusChangeListener

@NonNull open fun getOnAudioFocusChangeListener(): OnAudioFocusChangeListener

Gets the focus change listener set for this AudioFocusRequestCompat.

Return
OnAudioFocusChangeListener: The AudioManager.OnAudioFocusChangeListener that was set.

getFocusChangeHandler

@NonNull open fun getFocusChangeHandler(): Handler

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

Return
Handler: the same Handler set in. .

getFocusGain

open fun getFocusGain(): Int

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

Return
Int: one of AudioManagerCompat#AUDIOFOCUS_GAIN, , , and .

willPauseWhenDucked

open fun willPauseWhenDucked(): Boolean

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

Return
Boolean: the duck/pause behavior.

getAudioAttributesCompat

@NonNull open fun getAudioAttributesCompat(): AudioAttributesCompat

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

Return
AudioAttributesCompat: non-null AudioAttributesCompat.