Omeya / a2dpvolume

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

Don't re-connect a device that is already connected #87

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
My setup is a car that has Bluetooth headset-only functionality (meaning only 
phone audio, not a2dp), plus I have a separately installed a2dp receiver 
(Griffin Bluetrip) that does not have headset audio. My Galaxy Nexus connects 
automatically to the car (headset audio), but not to the Bluetrip. This app 
does a great job of getting the phone to connect to the Bluetrip as soon as the 
car starts.. however..

I've noticed that if I'm not running a2dpvolume and manually connect the 
Bluetrip, it's rock solid and does not disconnect. However if I start the 
a2dpvolume service and let it do the connecting, then after about 30 seconds my 
Bluetrip gets disconnected. 

From the Toasts that pop up, it appears as if the phone is reconnecting to the 
car's headset audio. I'm guessing the car is connecting/disconnecting the 
headset audio, which causes the a2dpvolume service to try connecting to the 
Bluetrip again. I'm not sure why the car is connecting/disconnecting, but 
regardless, a2dpvolume shouldn't be trying to re-connect to a device it's 
already connected to.

Looking through the code, it does not appear that there is a check done to see 
if a connection already exists when launching a new connection.

I've done some android development and would be willing to help try to solve 
this.

Original issue reported on code.google.com by falend...@gmail.com on 28 Jan 2012 at 4:39

GoogleCodeExporter commented 9 years ago
Strange this would cause a disconnect.  I recently added a retry strategy per a 
user complaint.  They had a situation similar to your but their A2DP device was 
slow to power up and would not be ready fast enough for the connect to work.  I 
added a timer that retries ever 7 seconds for 21s.  This gives 4 total tries.  
Several have tested it and we all found it to work well.  I considered adding 
the already connected check in that strategy but found that Android appeared to 
ignore the retries if already connected anyway so it was not needed... so I 
thought.  I have ICS on my Xoom.  I will do some more testing with that to see 
if I can duplicate your issue.  While I am doing that, feel free to pull down 
the latest code with Murcuriel and try a few things yourself.  If you get a fix 
working, I can take a look at what you did and merge that back in.  We just 
have to be careful the fix for your issue does not break it for everyone else 
(that can easily happen).  Do do this you will need to uninstall the signed 
version of my app since the version you build will be unsigned, or signed with 
a different signature.

Original comment by JimR...@gmail.com on 28 Jan 2012 at 2:05

GoogleCodeExporter commented 9 years ago
Just verified this issue for ICS.  Will get a fix in to the next release.

Original comment by JimR...@gmail.com on 28 Jan 2012 at 5:37

GoogleCodeExporter commented 9 years ago
Fixed in 2.3.16.

Original comment by JimR...@gmail.com on 28 Jan 2012 at 5:59

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 7dff7be769e4.

Original comment by JimR...@gmail.com on 28 Jan 2012 at 6:03

GoogleCodeExporter commented 9 years ago
I can verify that the issue has been fixed.

Works perfectly for me now. Thanks for the quick turnaround. I'll keep an eye 
on the development here and maybe I will try to help with some of the proposed 
enhancements to return the favor :-)

Original comment by falend...@gmail.com on 31 Jan 2012 at 9:45