Skip to content

Most visited

Recently visited

navigation
Added in API level 8

AudioManager.OnAudioFocusChangeListener

public static interface AudioManager.OnAudioFocusChangeListener

android.media.AudioManager.OnAudioFocusChangeListener


Interface definition for a callback to be invoked when the audio focus of the system is updated.

Summary

Public methods

abstract void onAudioFocusChange(int focusChange)

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

Public methods

onAudioFocusChange

Added in API level 8
void onAudioFocusChange (int focusChange)

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.

Parameters
focusChange int: the type of focus change, one of AUDIOFOCUS_GAIN, AUDIOFOCUS_LOSS, AUDIOFOCUS_LOSS_TRANSIENT and AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.