Rate this page:

AudioFocusListener

Interface may be used to monitor audio focus.

Methods

onAudioFocusChanged

Copy URL
fun onAudioFocusChanged(focus: 

Int

):

Unit

Invoked when the audio focus of the system is updated. Invoked on main thread.

Parameters

  • focus:

    Int

    The type of focus change, one of the following:

    • AudioManager.AUDIOFOCUS_GAIN
    • AudioManager.AUDIOFOCUS_GAIN_TRANSIENT
    • AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE
    • AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK
    • AudioManager.AUDIOFOCUS_LOSS
    • AudioManager.AUDIOFOCUS_LOSS_TRANSIENT
    • AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK

Returns

  • type:

    Unit