I am working on a VOIP application that is doing audio Streaming using openSL.
I cannot get any bluetooth Headset audio to work properly.
AudioManager mode is set to MODE_IN_COMMUNICATION, I request audio focus with AudioManager.STREAM_VOICE_CALL, OpenSL playback configuration stream type is set to SL_ANDROID_STREAM_VOICE, and the recording preset is configured with SL_ANDROID_RECORDING_PRESET_VOICE_COMMUNICATION.
I also use device optimal samplingrate and buffersize.
Everything works fine in speaker mode, with wired headset but when I connect a bluetooth headset I usually get audio playback for the microphone (input stream) is not working.
For bluetooth, I call startBluetoothSco() when I detect a headset using BroadcastReceiver. (I also tried to use setBluetoothScoOn(true) but I am not sure I understand what it means.
When I connect a Watch it is even worst because the Because I get Audio state to connect and immediatly after it disconnects and I get no audio even in playback.
I am really out of ideas to fix that.
Anyone has made a Voip App that is able to properly manage audio headsets dynamic changes.