Android 在手机铃声响起时,将TTS输出路由至蓝牙耳机

Android 在手机铃声响起时,将TTS输出路由至蓝牙耳机,android,bluetooth,text-to-speech,Android,Bluetooth,Text To Speech,我有一个EDR蓝牙耳机,需要将TTS语音路由到耳机。我可以在不调用时使用以下代码实现它 AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); am.startBluetoothSco(); am.setBluetoothScoOn(status); ttsMap.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioM

我有一个EDR蓝牙耳机,需要将TTS语音路由到耳机。我可以在不调用时使用以下代码实现它

AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
am.startBluetoothSco();
am.setBluetoothScoOn(status);
ttsMap.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_VOICE_CALL));
但我需要将语音路由到蓝牙设置,而手机正在为我的应用程序鸣响,我只能听到蓝牙模块的来电警报。当手机铃声响起时,是否存在将音频路由到蓝牙设备的黑客行为


任何帮助都将不胜感激。

在以下情况下,您的完整代码是什么:1)在程序说出文本字符串(联系人姓名)时,以及2)在程序说出John Doe在您的程序的语音设置下测试语音的示例文本字符串时?