Reputation: 9072
I am writing an application that uses MediaRecorder for recording audio. ( I use Android 2.1 )
Thanks in advance!
Upvotes: 0
Views: 852
Reputation: 21
It's an old question but I show the way I solve this problem. Maybe someone will need this help. Note: it's a dirty way but it worked for me.
You can try/catch MediaRecorderObject.start(). You will get an exception if the mic is busy
MediaRecorder myAudioRecorder = new MediaRecorder();
myAudioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
myAudioRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
myAudioRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
myAudioRecorder.setOutputFile(outputFile);
try {
myAudioRecorder.prepare();
myAudioRecorder.start();
}
catch (Exception exception) {
Toast.makeText(getApplicationContext(), "Mic in use", Toast.LENGTH_LONG).show();
}
Upvotes: 0
Reputation: 9072
Answer to 1 question: After reading many articles I realized that it was impossible.
Upvotes: 1