1

In my app i'm recording audio via Bluetooth and playback the audio to wire headset at the same time. My app works on older OS but not the latest OS.

I've been searching and reading old postings and could not figure a way to force audio play back to headset or ear piece using AudioTracker on newer Android OS 9+ while connected to Bluetooth audio.

I read this link but it does not work on AndroidOS 9+

Route default audio to ear piece

Set Audio manager

   manager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
   manager.setMode(MODE_IN_COMMUNICATION);

Playback using AudioTrack

            player = new AudioTrack(MODE_IN_COMMUNICATION, sample_rate, AudioFormat.CHANNEL_OUT_MONO,
            AudioFormat.ENCODING_PCM_16BIT, minBuffer, AudioTrack.MODE_STREAM);

With the above the playback is output to the Bluetooth device. I have tried the Reflection code above and it does not work.

Is it possible to reroute playback audio when connected to Bluetooth device?

Smiley
  • 31
  • 1
  • 4
  • As far as I know, it is ok if we want to play stream. I use normal mode and it works for me. But there's a problem when we try to record using bluetooth headset. Some devices just don't work for some reason. I have problems with Samsung Galaxy buds. Did you resolve this issue? – user12628549 Dec 03 '21 at 19:40
  • No. I have Samsung S10 and when recording from bluetooth the playback still goes to the bluetooth. – Smiley Dec 04 '21 at 17:38

0 Answers0