Recording audio by multiple processes on Android


I am writing an Android application which is required to record audio continuously in the background. However, the application should not prevent other applications from recording audio (such as voice recorders or VoIP apps). In other words I want my application to have the lowest priority with respect to others and yield the audio source (microphone) when another application/process requests it.

I found it impossible to do this using the audio recording APIs in the Android SDK so I turned to the native audio API provided by OpenSL ES. The documentation states that OpenSL objects may be assigned priorities and set as preemptable. I was wondering if that would be what I’m looking for. That is, if I set my AudioRecorder object as preemptable and start recording with it, will it yield the microphone resource once another application requests it?

The Android native audio APIs based on OpenSL ES 1.0.1 do not support priorities and preemption. I am not aware of a way to do what you’re proposing. It could have privacy/security issues.