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.

Sky Kelsey
  • 19,192
  • 5
  • 36
  • 77
user835791
  • 177
  • 1
  • 13

1 Answers1

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();
Parvin Gasimzade
  • 25,180
  • 8
  • 56
  • 83
user998953
  • 654
  • 5
  • 16