How to record sound using bluetooth headset
<p>I am writing an android app for storing and managing voice memos with some basic metadata and tagging. When recording sound I use: </p>

<pre><code>recorder = new MediaRecorder();         
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(currentRecordingFileName);
// and so on
</code></pre>

<p>This works well when using the phone in a normal fashion. However, it does not detect the presence of a bluetooth headset and still uses the phone's own microphone even when the headset is plugged in.</p>

<p>I also tried using MediaRecorder.AudioSource.DEFAULT, hoping it would automatically choose the correct source, but then no sound was recorded at all.</p>

<p>How can I a) detect if a bluetooth headset is plugged in and/or b) use a bluetooth headset as audio source for the media recorder?</p>
