Added in API level 29

AudioRecordingMonitor


public 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 getActiveRecordingConfiguration()

Returns the current active audio recording for this audio recorder.

abstract void registerAudioRecordingCallback(Executor executor, AudioManager.AudioRecordingCallback cb)

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

abstract void unregisterAudioRecordingCallback(AudioManager.AudioRecordingCallback cb)

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
public abstract AudioRecordingConfiguration getActiveRecordingConfiguration ()

Returns the current active audio recording for this audio recorder.

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

registerAudioRecordingCallback

Added in API level 29
public abstract void registerAudioRecordingCallback (Executor executor, 
                AudioManager.AudioRecordingCallback cb)

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
public abstract void unregisterAudioRecordingCallback (AudioManager.AudioRecordingCallback cb)

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