Audio routing problem with a bluteooth headset on Android


I’m developing an Android library in Java that handles headphones detection. The library aims to detect when various types of headphones, including wired headphones, Bluetooth A2DP, and Bluetooth SCO headsets, are connected to an Android device.

I’m facing an audio issue in my Unity project when connecting a headset that has both TYPE_BLUETOOTH_A2DP and TYPE_BLUETOOTH_SCO device types. When the headset is connected, the audio in my game gets cut out and disappears completely

Has anyone encountered a similar problem or can provide some guidance on how to handle these two device types without the audio disruptions? Any help, insights, or suggestions would be greatly appreciated.

Thank you!