austgl / a2dpvolume

Automatically exported from code.google.com/p/a2dpvolume
0 stars 0 forks source link

Device specific text message stream #63

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Now that the Text-To-Speech (TTS) feature works for reading SMS messages, I 
would like to be able to define which stream to send the message to.  The 
default stream in Android usually chooses the A2DP stream.  I would prefer to 
send SMS to the voice stream when in certain cars.  My Motorola T605 car kits 
support the separate streams differently.  

This is easily implemented as illustrated here: 
http://android-developers.blogspot.com/2009/09/introduction-to-text-to-speech-in
.html

I can let the user select which stream the SMS will be read through.

Original issue reported on code.google.com by JimR...@gmail.com on 14 Aug 2011 at 1:58

GoogleCodeExporter commented 9 years ago
This would be great to have.

There is one problem: You have to set audio maganer to use 
AudioManager.startBluetoothSco(), which is not required to succeed.

Thaks for pointing to Audiomanager. E.g. I don't get it, why Google Maps 
Navigation cannot do this at the moment. By not using A2DP and instead 
BluetoothSco, my stereo would also automatically stop playing music and handle 
the phone streaming request as a phone call, interrupting the current 
CD/Radio/Cassette playing. With A2DP I cannot do this, as I have to set the 
input source to A2DP. This would make SMS reading or Navigation Instructions 
behave as you would expect it from a car - stop radio playing, read nav 
instruction, and switch back to radio.

I will point my issue at GoogleMaps to this API, thanks.

Original comment by uwe.h.schindler on 15 Aug 2011 at 7:04

GoogleCodeExporter commented 9 years ago
I did some research, it seems impossible to route non-phone-calls from 
third-party pass through mono headsets (e.g. Handsfree profile): 
http://code.google.com/p/android/issues/detail?id=7192

The APIs are available, but seem only be useable by system apps. This may be 
the reason why Google Maps cannot do this untiul today. This is too stupid and 
makes me angry each time I use turn-by-turn navigation in my car.

Original comment by uwe.h.schindler on 15 Aug 2011 at 8:01

GoogleCodeExporter commented 9 years ago
Issue 67 has been merged into this issue.

Original comment by JimR...@gmail.com on 16 Aug 2011 at 10:51

GoogleCodeExporter commented 9 years ago

Original comment by JimR...@gmail.com on 16 Aug 2011 at 10:53

GoogleCodeExporter commented 9 years ago
Sorry for posting in the wrong thread.   Getting may older EDR headset working 
with the Galaxy S2 if probably very unlikey.   I expect I will have to buy an 
A2DP headset; but, I think the need for A2DP stereo to mono may not have been 
aparent.   Best of luck I will stay tuned & donate when your ready.   Thankyou.

Original comment by offer.st...@gmail.com on 16 Aug 2011 at 11:05

GoogleCodeExporter commented 9 years ago

Original comment by JimR...@gmail.com on 21 Aug 2011 at 3:18

GoogleCodeExporter commented 9 years ago
I finally got it working!!!  Download and test 2.3.1.  Here is how it works 
now: 

1 SMS message received
2 A2DP Music is paused (if playing)
3 Phone Bluetooth switched to in-call stream from A2DP
4 Message is played through speaker that is used for phone calls (bluetooth 
phone stream/speaker)
5 After message completes, A2DP music resumes (if it was playing).

Original comment by JimR...@gmail.com on 24 Aug 2011 at 2:21

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 1b23a24e3059.

Original comment by JimR...@gmail.com on 24 Aug 2011 at 2:27

GoogleCodeExporter commented 9 years ago
I need testers for 2.3.3 that addresses this and other issues.  I need to know 
how this works on a variety of phones and Bluetooth receivers.  I added a TTS 
reader delay configuration in the preferences too.  Please download 2.3.3 and 
help me test.  Report any issue to this issues list.

Original comment by JimR...@gmail.com on 28 Aug 2011 at 5:25

GoogleCodeExporter commented 9 years ago
Hi Jim,

I cam back from California today, so I will test it with my car soon. I hope my 
Android version does not have the bluetooth bug where it reboots (see several 
issues trying to do the same like you did). So it would be good if this feature 
is configureable.

Also I will tell how it works with Handsfree profile, as most solutions (that 
reboot my phone after disconnect when the app reroutes A2DP through this 
profiles) only support headset profile, which is different and not available in 
most cars.

Original comment by uwe.h.schindler on 28 Aug 2011 at 5:58

GoogleCodeExporter commented 9 years ago
So I guess I oversold the changes I made.  I did not actually reroute streams 
but rather select a stream for the SMS TTS from my app.  That is different than 
rerouting.  My texts should read through the SCO stream, if your device 
supports isBluetoothScoAvailableOffCall().  If not, I revert to the music 
stream again.  I need to know how this works on various devices before deciding 
on the best way to proceed.  I tested it with a Droid 3 connected to a Motorola 
T605 car kit and it worked great.  I also tried an original Droid in a car dock 
(no Bluetooth active) and it worked fine there too.  So, I need to understand 
how it works on a few devices before figuring out what kind of additional 
configuration is needed.

Original comment by JimR...@gmail.com on 28 Aug 2011 at 6:05

GoogleCodeExporter commented 9 years ago

Original comment by JimR...@gmail.com on 28 Aug 2011 at 6:05

GoogleCodeExporter commented 9 years ago
Just found I added a but between 2.3.2 and 2.3.3.  Test 2.3.2 to see if the 
voice stream works first.  I will fix shortly and release 2.3.4.

Original comment by JimR...@gmail.com on 28 Aug 2011 at 7:06

GoogleCodeExporter commented 9 years ago
2.3.3 should work at long as the SMS delay is not 0.

Original comment by JimR...@gmail.com on 28 Aug 2011 at 7:51

GoogleCodeExporter commented 9 years ago
For my phone, HTC Desire, Android 2.2.0 this does not work. The car (with 
Blue&Me) does not switch to phone mode automatically when a SMS arrives, so 
does not read the message. The Stereo does not show "PHONE" like it does when a 
call comes in and was accepted by the car's software. I cannot hear anything 
from any loadspeaker (phone or car).

As my phone has the buggy bluetooth implementation from Android 2.2.0 (which 
was fixed later by google, see various isses with other software trying to do 
the same like you did), after disconnecting the phone's bluetooth connection it 
crashes and reboots - this verifies that the phone had indeed a handsfree 
connection; but the car did not accept this as a phone-call. This crash/reboot 
issue is a well known problem with the Headset profile, which was fixed in 
Android 2.2.1 - unfortunately my phone does not have this software and 
Gingerbread (2.3) is not acceptable on this phone (to few memory with HTC Sense 
UI).

Original comment by uwe.h.schindler on 29 Aug 2011 at 11:30

GoogleCodeExporter commented 9 years ago
Finally this means, the new software version breaks my phone completely, I 
reverted from backup. So at least there should be a configuartion switch to 
change the output mode of SMS.

Original comment by uwe.h.schindler on 29 Aug 2011 at 11:32

GoogleCodeExporter commented 9 years ago
In 2.3.4 or earlier you will need to make sure the SMS delay time is not 0.  I 
had a bug in that release if the delay was 0 the problem you encountered will 
happen.  

There is a check for supporting SCO when not on call that I check before 
turning ON and OFF SCO.  If your phone does not support this, it will skip it 
and not enable SCO when off call.  

I did add the configuration option of using the music stream or voice call 
stream for reading SMS in 2.3.5 (not yet released).  I also fixed the bug 
described above that was in 2.3.3.  I added some comments in issue 68 relating 
to this as well.  I am trying to fix both these issues (63 and 68).

Thanks for testing and letting me know how it went.  I should have 2.3.5 out 
soon for testing.  

Original comment by JimR...@gmail.com on 29 Aug 2011 at 12:22

GoogleCodeExporter commented 9 years ago
Having trouble getting the pause/resume working correctly.  Also found that if 
I try to pause the music right after the SMS plays, the music player keeps 
resuming by itself and it cant be stopped.  If I wait a few seconds before I 
try to pause its fine.  That is using the Android 2.2 emulator.  Strange.  I 
had created a focusChangedListener but it was never called.  I removed that and 
use null for the listener since I don't do anything special for the focus 
happening.  That did not seem to make a difference.  I think I need to sleep on 
it....

Original comment by JimR...@gmail.com on 30 Aug 2011 at 1:53

GoogleCodeExporter commented 9 years ago
Release 2.3.7 improves the options for SMS stream, but it does not really 
address this issue which was looking for the ability to specify streams for 
things like navigation when the device connects.  I will leave this issue open 
for now as we investigate more but based on the comments earlier in this 
thread, it is looking grim.

Original comment by JimR...@gmail.com on 4 Sep 2011 at 3:50

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I'm not sure if this feature is supposed to work as I think but here is my 
situation.  My car has a hands free system, but not an A2DP system.  I listen 
to music in my car with an iPod connector, if a text comes in, it plays through 
the phones speaker, and I frequently miss them.  I thought if I chose phone 
stream, that it would mute the music, and read the text, then my music would 
play again.  It would be great if this could happen.  Also, if you can route 
audio to different streams, is it possible to route all media audio to the 
phone stream so my car that doesn't have an A2DP system would behave like it 
did?

In addition, it would be great if you could pick an automated text reply on a 
per unit basis.  For example, if connected to my car, it could reply,  "In car, 
please call if urgent."  If connected to my Jabra Clipper, it could say "Will 
reply in 30 minutes".

Original comment by aarb...@gmail.com on 31 Jan 2012 at 3:37

GoogleCodeExporter commented 9 years ago
I had the SMS reading working on my Galaxy Nexus using the default Google TTS 
service. Then I restored my device to use a different default Google account 
and now I can't get it to read the messages.

The Google TTS test works just fine.

I've tried every channel for the stream.

I've tried all the wiki suggestions.

Any clue what I need to do to get it to work? That was one feature I loved!

Original comment by zook...@gmail.com on 21 Mar 2012 at 10:39

GoogleCodeExporter commented 9 years ago

Original comment by JimR...@gmail.com on 22 Apr 2012 at 10:07

GoogleCodeExporter commented 9 years ago
There is hope!
http://developer.android.com/reference/android/media/MediaRouter.html
Jelly Bean introduced a new interface for routing streams!!!  I am reopening 
this issue and will work it when I get time.  I just got Jelly Bean on the Xoom 
so I have some ability to test it out.  Stay tuned.

Original comment by JimR...@gmail.com on 4 Aug 2012 at 1:40

GoogleCodeExporter commented 9 years ago
Issue 74 has been merged into this issue.

Original comment by JimR...@gmail.com on 4 Aug 2012 at 1:42

GoogleCodeExporter commented 9 years ago
I tried a few things today but did not make real progress.  Here is a thread I 
started on the topic:
http://stackoverflow.com/questions/13984015/how-to-capture-or-reroute-navigation
-voice-stream

Original comment by JimR...@gmail.com on 21 Dec 2012 at 9:34

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/android/issues/detail?id=40193

Original comment by JimR...@gmail.com on 30 Dec 2012 at 2:51

GoogleCodeExporter commented 9 years ago
Issue 154 has been merged into this issue.

Original comment by JimR...@gmail.com on 20 Feb 2013 at 11:53