I use AudioRecord API to record audio (WAV) in my app, and it records successfully. But my app behaves strange when i try to record while other recording apps are running in the background.
The MediaRecorder API throws exception when attempting to start recording while another recorder is running but the AudioRecord API initializes the recorder instance and doesn't throw any exceptions, so i cant identify whether any recorder instance is running or not.
This scenario has been handled in Samsung S3's default Voice Recorder, when i try to record it says
" Unable to start new recording. Other applications already recording"
How can i identify whether any other recorder is running or not before my app's recorder starts?
Smart Recorder is the best secret voice recording app for Android users. The app can record surrounding voice even when the display is off.
I have found solution to this problem
Since the AudioRecord doesn't throw any exceptions unlike MediaRecorder API, i have gone for another workaround.
When another recorder instance is running i have found that the read method returns 0 instead of ERROR_INVALID_OPERATION or ERROR_BAD_VALUE. So if the first read operation returns 0 , i showed an error message as "Recorder cannot be initialized".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With