Constructors
new AudioFocusManager()
new AudioFocusManager():AudioFocusManager
Returns
AudioFocusManager
Properties
defaultFocusSession
static defaultFocusSession: AudioFocusSession = null
Methods
createAudioFocusSessionAsync()
static createAudioFocusSessionAsync(): Promise<AudioFocusSession>
Creates a new AudioFocusSession.
Each session can independently manage audio focus requests and callbacks.
Multiple sessions can be created to manage different audio streams independently.
Example use cases:
- Different sessions for music playback and navigation
- Separate session for voice assistant responses
- Independent session for game audio
Returns
Promise<AudioFocusSession>
A promise that resolves to:
- New AudioFocusSession object if successful
STATUS_NO_MEMORY (-1): Failed to allocate sessionSTATUS_NO_INIT (-3): Audio focus system not initializedSTATUS_DEAD_OBJECT (-5): Server communication error
destroyAudioFocusSessionAsync()
static destroyAudioFocusSessionAsync(sessionObject): Promise<AudioFocusStatus>
Destroys an existing audio focus session and releases all associated resources.
This must be called when the session is no longer needed to free up system resources.
Any active focus requests in this session will be automatically released.
Important: Do not attempt to use the session object after destroying it.
Parameters
sessionObject
AudioFocusSession
The session to destroy
Returns
Promise<AudioFocusStatus>
A promise that resolves to:
AUDIO_FOCUS_STATUS_NO_ERROR (0): Session destroyed successfullyAUDIO_FOCUS_STATUS_BAD_VALUE (-2): Invalid session objectAUDIO_FOCUS_STATUS_NO_INIT (-3): Audio focus system not initializedAUDIO_FOCUS_STATUS_INVALID_OPERATION (-8): Session already destroyed

