3

I have a TTS Application which works fine on phone speaker and wired headsets. But when I connect Bluetooth headset, it does not speak on Bluetooth headset.

How can I do this without using any deprecated API.

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

Please guide how can I send my TTS output to bluetooth.

1 Answer 1

1

Are you sure you 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();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.