Reputation: 123
As we know,we could record voice via Bluetooth headset,we should use SCO link, but when a call coming, the system will lost sco link,so that, I can't get PCM data from SCO link. how to resolve it. I'd try to this code,but it doesn't work.
AudioManager am = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
am.setMode(AudioManager.MODE_IN_COMMUNICATION);
am.startBluetoothSco();
am.setBluetoothScoOn(true);
when phone is ringing, can i record from SCO?
Upvotes: 0
Views: 111
Reputation: 2706
Android changes audio routing depending on its needs, and when the phone is ringing (and/or when the call is answered) the audio is re-routed to target device (earpiece, headphones, BT, etc..). It's impossible to start a single recording Object and get all the data (the data before, current and future voice during communication), but you have to monitoring the voicecall status (or the current Audio Routing state) and close the previous recording object and then create a new one using different settings.
If you are interested ONLY in your voice while your phone is ringing, you could do it by recording that data using UPLINK as the AudioSource of Recording object.
Upvotes: 1