-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Didn't get an answer to my last question, so perhaps I should just ask it differently.
I'm trying to route preferably all audio but if that isn't possible only TTS from my app through a bluetooth SCO earpiece. I'm aware that the quality will be low but don't care in this instance. I've dug around and have found the intents that are triggered when a bluetooth headset changes state. I can't, however, ever get my app's audio playing through the earpiece. I don't know what I'm doing here, and am just trying a bunch of things that work. Likely, this solution isn't complete, and I'm sure it needs to handle SCO connection failure, but for the moment I'm just trying to get something working. I have the following Scala code running when the earpiece disconnects/reconnects. There are various niceties that aren't stock Android, but hopefully it's plain what I'm doing. if(on) { actor { // Wait 5 seconds in the background to see if an A2DP headset connects first. Thread.sleep(5000) if(!audioManager.isBluetoothA2dpOn) { TTS.stream = AudioManager.STREAM_VOICE_CALL audioManager.setMode(AudioManager.MODE_IN_CALL) // Needed? audioManager.setBluetoothScoOn(true) // How about this? audioManager.startBluetoothSco() // And this? Do I need both on and start? } } } else if(!on) { TTS.stream = AudioManager.STREAM_MUSIC audioManager.setBluetoothScoOn(false) audioManager.stopBluetoothSco() audioManager.setMode(AudioManager.MODE_NORMAL) } The one possibility I thought of when I asked my last question was that perhaps TTS audio is stereo and SCO specifically requires a mono stream, which is why I asked about changing the stream format, but maybe someone else has solved this problem and can point me in the right direction. Clearly someone has, as there's a paid app on the market that does this, but I'd very much like to fold this particular feature into my own app. Android a11y is already a mess of "first install a screen reader, next install the settings app, then install one or more additional AccessibilityServices..." If I can avoid adding yet another app to my own experience, which I've thus far kept consolidated to just a single install, then that'd rock. I'm really confused about the various SCO/A2DP methods in AudioManager. What's the difference between setting SCO on and starting a connection? Does the latter imply the former? The docs on this might need some work. :) Thanks. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAky1UkkACgkQIaMjFWMehWIwtACdH8UwoYqpZ/NQhNwyjmU0tFoI p2sAn1U4Uu1xE+os30q38nqEA0+Tp7/d =Dvzi -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en