0

I connected a Bluetooth headset to an Android 11 device and executed the following lines of code

audioManager?.isBluetoothScoOn = true
audioManager?.startBluetoothSco()
audioManager?.mode = AudioManager.MODE_IN_COMMUNICATION
audioManager?.isSpeakerphoneOn = false

so the audio input and output are now from the BT device.

But, if I plug in a USB audio device or a wired headset, the audio automatically redirects to the plugged-in device.

I want to stop audio routing to the plugged-in device when a Bluetooth device is connected

I tried executing this code again

audioManager?.isBluetoothScoOn = true
audioManager?.startBluetoothSco()
audioManager?.mode = AudioManager.MODE_IN_COMMUNICATION
audioManager?.isSpeakerphoneOn = false

to route audio back to the Bluetooth device, but the audio is not getting transferred back.

I am looking for a help in either stopping the automatic audio routing to USB device or any method to route the audio back to the Bluetooth device.

0 Answers0