问题
I'm a newbie for android. I've created an app that can read Incoming messages using Android Text-To-Speech. Up to now its fine with it. Now user's want It has to play over paired Bluetooth.
I'd read all the forums but i didn't get it. Now how i play my TTS engine on Bluetooth ?
Anyone having any idea ?
Thanks in advance.
回答1:
Use my answer at Using the Android RecognizerIntent with a bluetooth headset
And create a speak method like below
protected void speak(String text)
{
HashMap<String, String> myHashRender = new HashMap<String, String>();
if (mBluetoothHelper.isOnHeadsetSco())
{
myHashRender.put(TextToSpeech.Engine.KEY_PARAM_STREAM,
String.valueOf(AudioManager.STREAM_VOICE_CALL));
}
mTts.speak(text, TextToSpeech.QUEUE_FLUSH, myHashRender);
}
来源:https://stackoverflow.com/questions/15392457/how-to-text-to-speech-plays-on-bluetooth-in-android