Want to play TTS on a Bluetooth headset

I have a TTS app that works great on phone speakers and wired headsets. But when I connect the bluetooth headset, it does not talk on the bluetooth headset.

How can I do this without using the deprecated API.

The problem is in Android 2.3 AudioManager .. setRouting (), setBluetoothA2DP are all deprecated.

Please explain how I can send my TTS output to Bluetooth.

+3
source share
1 answer

Are you sure you will try this:

HashMap<String, String> myHashAlarm = new HashMap<String, String>(); myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_SYSTEM_CALL)); mTts.speak(" aabb1321100111000",TextToSpeech.QUEUE_ADD, myHashAlarm); AudioManager mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE); mAudioManager.setStreamMute(AudioManager.STREAM_VOICE_CALL, true); mAudioManager.startBluetoothSco(); 
+1
source

All Articles