Enclosing class: : BaseAudioDevice


public static interface BaseAudioDevice.AudioFocusManager

Used to delegate audio focus control to your app. This object is returned by calling AudioDeviceManager.getAudioFocusManager().

See Also: : - Creating a VoIP app using the Android ConnectionService

Method Summary

All MethodsInstance MethodsAbstract Methods

Modifier and Type

Method

Description

void

audioFocusActivated()

Notifies the SDK that the audio focus has been gained.

void

audioFocusDeactivated()

Notifies the SDK that the audio focus has been lost.

void

setRequestAudioFocus(boolean requestAudioFocus)

Signals the audio device if audio focus is requested externally.

Method Details

setRequestAudioFocus

void setRequestAudioFocus(boolean requestAudioFocus)

Signals the audio device if audio focus is requested externally. The method determines whether the SDK will automatically request audio focus, or leave that responsibility to the application (for example, when integrating with ConnectionService).

On external audio focus management, Vonage SDK will not handle automatically the audio output routing. When using ConnectionServices, you should leverage the Telecom framework's built-in audio routing capabilities. The platform provides your app with a unified list of the audio routes which are available (for example, Connection.onAvailableCallEndpointsChanged(List)) and a standardized way to switch audio routes (for example, Connection.requestCallEndpointChange(CallEndpoint, Executor, OutcomeReceiver)).

Parameters: : requestAudioFocus - Whether the audio device should request audio focus. Pass in true for automatic audio focus management, or false when external (manual) activation is required, such as with ConnectionService. By default, audio focus is request internally by the SDK.

**Note:** This method should be called early in the application's lifecycle, typically
during app launch or before initiating any audio/video sessions.

audioFocusActivated

void audioFocusActivated()

Notifies the SDK that the audio focus has been gained.

This method should be called when the system (for example, via ConnectionService) has activated the audio focus. It informs the SDK that audio is now ready to be used and that the focus is active. It should be called when the AudioManager.AUDIOFOCUS_GAIN state is received in the AudioManager.OnAudioFocusChangeListener or after calling AudioManager.requestAudioFocus(AudioFocusRequest focusRequest).

Note: This method is only relevant when you call setRequestAudioFocus(false). If called without requesting manual handle of audio focus, it will be ignored since the SDK handles audio focus activation automatically.

audioFocusDeactivated

void audioFocusDeactivated()

Notifies the SDK that the audio focus has been lost.

This method should be called when ConnectionService has lost audio focus. It is used to inform the SDK that the audio focus is no longer active and should be reset. It should be called when the AudioManager.AUDIOFOCUS_LOSS state is received in the AudioManager.OnAudioFocusChangeListener or after calling AudioManager.abandonAudioFocusRequest(AudioFocusRequest focusRequest).