Added in API level 29

AudioRecordingMonitor


interface AudioRecordingMonitor
android.media.AudioRecordingMonitor

AudioRecordingMonitor defines an interface implemented by AudioRecord and MediaRecorder allowing applications to install a callback and be notified of changes in the capture path while recoding is active.

Summary

Public methods
abstract AudioRecordingConfiguration?

Returns the current active audio recording for this audio recorder.

abstract Unit

Register a callback to be notified of audio capture changes via a AudioManager.AudioRecordingCallback.

abstract Unit

Unregister an audio recording callback previously registered with registerAudioRecordingCallback(java.util.concurrent.Executor,android.media.AudioManager.AudioRecordingCallback).

Public methods

getActiveRecordingConfiguration

Added in API level 29
abstract fun getActiveRecordingConfiguration(): AudioRecordingConfiguration?

Returns the current active audio recording for this audio recorder.

Return
AudioRecordingConfiguration? a valid AudioRecordingConfiguration if this recorder is active or null otherwise.

registerAudioRecordingCallback

Added in API level 29
abstract fun registerAudioRecordingCallback(
    executor: Executor,
    cb: AudioManager.AudioRecordingCallback
): Unit

Register a callback to be notified of audio capture changes via a AudioManager.AudioRecordingCallback. A callback is received when the capture path configuration changes (pre-processing, format, sampling rate...) or capture is silenced/unsilenced by the system.

Parameters
executor Executor: Executor to handle the callbacks. This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.
cb AudioManager.AudioRecordingCallback: non-null callback to register

unregisterAudioRecordingCallback

Added in API level 29
abstract fun unregisterAudioRecordingCallback(cb: AudioManager.AudioRecordingCallback): Unit

Unregister an audio recording callback previously registered with registerAudioRecordingCallback(java.util.concurrent.Executor,android.media.AudioManager.AudioRecordingCallback).

Parameters
cb AudioManager.AudioRecordingCallback: non-null callback to unregister