The implementation of routing policies is platform dependent and therefore may vary slightly between different products, but this is what I suggest:
If an A2DP-enabled device is paired / connected "for multimedia use", it should be the default output device for MUSIC streams. Therefore, if you are not doing anything, the sound should be directed to the A2DP device.
To redirect sound to a speaker instead of an A2DP device, use the AudioManager method setBluetoothA2dpOn with false . This method has been marked as deprecated for a long time, but still exists and performs the advertising action the last time I checked.
To redirect the sound to the speaker, use the VOICE_CALL stream VOICE_CALL and use the AudioManager setMode method to change the mode to MODE_IN_CALL . You can also disable bluetooth with setBluetoothScoOn(false) .
source share