jroal / a2dpvolume

Automatically exported from code.google.com/p/a2dpvolume
http://jimroal.com/slist.htm
95 stars 33 forks source link

Bluetooth visibility issues - auto Bluetooth visible feature request #119

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Android's bluetooth support lacks in some areas.

Most annoyingly (for me) is the whole Bluetooth visibility setting.

Every time my phone reboots, I have to go into Settings->Wireless and 
Network->Bluetooth Settings and enable visibility (discoverable).

I reboot several times a week, for a couple of reasons:
- I'm playing with a number of things - I'm a tinkerer
- Bluetooth on my phone tends to stop working periodically and requires a 
reboot.  Not sure why.  Did this long before I started tinkering.  Same happens 
on my wife's phone.

Since the a2dpvolume service is already loading at startup, it would be nice to 
see it automatically set my bluetooth to "visible".  This of course should be 
configurable, since not everyone will want this.

My car radio will only connect to my phone when the phone is in discoverable 
mode.

Thank you for producing a great app.

Original issue reported on code.google.com by tryoung...@gmail.com on 8 Jun 2012 at 5:51

GoogleCodeExporter commented 9 years ago
OK, that is weird.  Visibility mode is only used for pairing.  It should not be 
left ON at all times and I am not aware of any device that requires it to 
remain visible after pairing.  A2DP Devices require s forced connection 
sometimes and A2DP Volume already facilitates this.  Staying visible long term 
poses a security risk.  This is somewhat similar to leaving your WiFi at home 
open with no WEP.  Very much discouraged.

What car radio do you have?  I suspect it is the A2DP that will not connect 
properly as this has been an issue with many A2DP devices.  The fix is to force 
a connection.  A2DP Volume does this as long as you have some trigger such as a 
Bluetooth handsfree connection (most common), a power connection, or Car Mode.  
A2DP Volume supports all those triggers.  In your case does the car stereo also 
support hands free profile?  Most do.  And does that profile auto connect when 
you start the car (assuming of course you have Bluetooth already enabled).  If 
it does, then you just need to edit that device in A2DP Volume and use the also 
connect feature to connect back to the same device.  This will force the A2DP 
connection.

Original comment by JimR...@gmail.com on 9 Jun 2012 at 1:41

GoogleCodeExporter commented 9 years ago
I have a Pioneer head unit, model DEH-P980BT.

It support the hands-free profile.

I have both the car dock setting in A2DPvolume configured, as well as the 
Pioneer BT Unit configured.

There is no actual "Car Dock" bluetooth device if you do a bluetooth device 
survey.  I can see my wife's phone, and my car radio "Pioneer BT Unit".  There 
are no other devices I can connect to.

I configured the car dock in A2DPvolume to also connect to the Pioneer BT Unit.

This is what happens:

With "Bluetooth Visible" unchecked:  Nothing - wait as long as you like, it's 
still nothing.

With "Bluetooth Visible" checked:  The bluetooth connection is established, and 
everything works fine.

I double-checked every option in the BT Configuration page, in the A2DPvolume 
settings (program preferences, and device settings.  I also double-checked 
every option in the car radio - the setup pages, with the telephone selected, 
and with the BT audio selected.

I really must have VISIBLE enabled in order for an automatic connection to 
happen.

I can establish a connection manually, but this is not ideal.  I'd like it to 
be automatic.

Any ideas?

Original comment by tryoung...@gmail.com on 11 Jun 2012 at 4:00

GoogleCodeExporter commented 9 years ago
In order to see the "car dock" you must do in to A2DP Volume preferences and 
check the respond to car dock.  Once you do that and exit the preferences 
screen, a car dock device will show up in the list.  Since this is not a 
Bluetooth device it is handled a bit differently.  Audio jack, home dock, and 
power connection are also handled this same way.

Does your device auto-connect to the Pioneer handsfree profile?  If so, set up 
A2DP Volume to force connect an A2DP connection back when that device connects. 
 In other words, edit that Pioneer device in A2DP Volume and set it to connect 
back to itself.  This has fixed your issue for everyone else I know of.

Original comment by JimR...@gmail.com on 16 Jun 2012 at 12:25

GoogleCodeExporter commented 9 years ago

Original comment by JimR...@gmail.com on 16 Jun 2012 at 12:28

GoogleCodeExporter commented 9 years ago
Hi Jim!

The car dock already does appear in the list, because I configured it a long 
time ago.

You say the car dock is not a bluetooth device, so now I'm beginning to 
think...  do you think I have some sort of docking station that I plug my phone 
into when I'm in the car?  I don't have any such device.  I keep my phone in my 
holster.

I'll try setting it to connect back to itself again.  I'll let you know what 
happens shortly.

Original comment by tryoung...@gmail.com on 17 Jun 2012 at 5:26

GoogleCodeExporter commented 9 years ago
Ok, still not working, as I expected.

Let me describe my setup.

I have a car radio with bluetooth.

I do not have a docking station in my car for my phone.

Bluetooth visibility must be enabled in order to establish a connection to the 
car radio.  I cannot manually connect while invisible.

I don't want to remove my phone from the holster in order to plug it in to a 
car dock, to enable visibility, etc.

I would like it to connect automatically to my car stereo, with no intervention 
on my part.

Apparently this is a common problem.  It has been suggested that there are many 
car head units which don't seem smart enough to look periodically for paired 
devices that are also not discoverable.

It is probably not a big security risk to leave bluetooth discoverable, 
considering the connecting devices need my specific permission to connect, and 
I have to enter a PIN# to enable it.  At worst, someone could send me a torrent 
of annoying connection requests.  I'd rather have that small annoyance, then 
fumble with the phone while driving, trying to get it to connect, in order to 
answer what could be a medical emergency, like a family member having a seizure 
and someone called me because I'm the primary number in their ICE list.

Original comment by tryoung...@gmail.com on 17 Jun 2012 at 6:42

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
OK, certainly understand the requirement to leave the phone in your pocket as 
this is why I wrote this app to begin with.  Sorry to ask so many questions but 
I have connected many Bluetooth devices and never had the issue you describe.  
I understand there is no connection or docking station you are using and that 
is expected.  Therefore the "car dock" device will do nothing as your device 
has no trigger to enter car dock mode.  I just have a couple more questions for 
you before I accept this enhancement request and investigate a solution.

I looked into your Pioneer device in more details here:
http://www.pioneerelectronics.com/vgn/images/portal/cit_11221/311039059DEHP980BT
OperationManual.pdf
Read starting on page 34 through page 42.  Your unit has a concept of 
"registered" devices.  In order to automate the connection your phone must be 
both paired and registered as a user phone, and that registered device must be 
configured to auto connect.  Have you registered your phone and set it up to 
auto connect per pages 41 and 42 in this manual?  If you do, your hands free 
profile should auto connect.  Does that profile auto connect?  This means you 
should be able to make and receive phone calls but audio streaming (A2DP) may 
not yet work.

Now I am assuming your hands free profile is properly auto connecting but your 
A2DP does not.  Here is where most devices work by using the also connect to a 
bluetooth device feature in A2DP Volume.  You would edit the "Pioneer BT Unit" 
and have it also connect to the "Pioneer BT Unit".  It sounds like you have 
tried this but I just want to confirm.  The manual does not mention the 
requirement of discoverable to reconnect to a paired device but that does not 
mean it is not a requirement.  They often leave these details out.

Now that you have confirmed all of that, and you still can't get the A2DP to 
connect without activating discoverable mode, then I will investigate adding a 
feature to a future release to address your issue.  Here is my thought on how I 
would implement, assuming of course I finds a way to do this (I am pretty sure 
I can).  I would add a feature to each Bluetooth device and virtual device.  
When that device connects, I will add an option to "also temporarily activate 
discoverable mode".  I would have it active for 30s or so and then return it to 
normal (like discoverable mode works already).  This should give plenty of time 
to allow the connection.  Once connected it should maintain the connection 
until disconnected.  

Original comment by JimR...@gmail.com on 17 Jun 2012 at 12:20

GoogleCodeExporter commented 9 years ago
I started investigating implementation options.  Here is the normal way we can 
handle discovery:
http://developer.android.com/guide/topics/wireless/bluetooth.html#ConnectingDevi
ces
Notice this will just pop up a dialofg requesting the user OK entering 
discoverable mode.  This will not satisfy the requirement of leaving the device 
in your pocket.  I can maybe go against acceptable practices and create an 
interface to the lower level code to access this function: 
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/and
roid/4.0.1_r1/android/bluetooth/BluetoothAdapter.java#BluetoothAdapter.startDisc
overy%28%29
I am not sure even this will work though as it will likely result in a user 
dialog box waiting for your input.  Will need to look deeper.

Original comment by JimR...@gmail.com on 17 Jun 2012 at 12:40

GoogleCodeExporter commented 9 years ago
I created a test app that starts discovery.  I can't really test the fix since 
I don't have a device that experiences the problem.  What I did was add the 
startDiscovery(); function in where it tries to force connect an A2DP Device.  
So, make sure you configure your Pioneer BT device in A2DP Volume to connect 
back to itself.  Please install this test app and try it out.  Let me know if 
this works or not.

Original comment by JimR...@gmail.com on 17 Jun 2012 at 3:51

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Jim.

Thanks for taking the time to read the manual for my head unit.  I happen to 
have my copy right beside me too :)

The phone is registered, and all the settings are set correctly.

No profiles will auto-connect so long as the device is not discoverable.  This 
includes the phone, and A2DP connections.  That is what makes this such an 
important issue for me.

I did try to connect back to the head unit in the A2DPvolume Pioneer 
configuration, but nothing happens.  Just to make sure, I stopped, then 
re-started the service, although I believe I only have to do that if I change 
the main preferences.

I'll play with your test app, and see what happens.  You should hear back from 
me shortly.

I suspect this is a bug in the Pioneer head unit's implementation of Bluetooth 
and Bluetooth profiles.  There are no firmware updates for this head unit.  I'm 
very attached to this head unit, because it has a lot of features I like, 
including hi-volt pre-outs.  I haven't looked around lately to see if there's 
anything better, but at the time when I purchased this head unit, there was no 
other head unit that even came close to the specs (focusing solely on single 
DIN head units, not double-DIN).

Original comment by tryoung...@gmail.com on 18 Jun 2012 at 2:32

GoogleCodeExporter commented 9 years ago
I was assuming that your hands free profile did auto connect.  If that is not 
the case then my test app will not fix your issue.  What you need to do instead 
is just set Android to stay discoverable all the time.  There is a 
configuration for that in the settings.  It has a timeout for discovery and you 
can set it to never time out.  Try that.

Original comment by JimR...@gmail.com on 18 Jun 2012 at 2:40

GoogleCodeExporter commented 9 years ago
Hi Jim.

Sadly, it doesn't work.

I think you're looking for a trigger to temporarily set discoverability, but a 
trigger won't be sufficient.  If visibility is off, no trigger will happen.  
That's the feeling I'm getting.

Original comment by tryoung...@gmail.com on 18 Jun 2012 at 2:47

GoogleCodeExporter commented 9 years ago
Hi Jim.  Yeah, I know about that setting.  I have to enable it all the time. 

The problem is, I tend to reboot my rooted phone periodically.  Sometimes I 
have to because the bluetooth just stops working all together, and a reboot is 
the only way to fix it.

I am looking for a solution to automatically enable visibility.  Once it's 
enabled, I have no problems.

Original comment by tryoung...@gmail.com on 18 Jun 2012 at 2:52

GoogleCodeExporter commented 9 years ago

Original comment by JimR...@gmail.com on 18 Jun 2012 at 2:54

GoogleCodeExporter commented 9 years ago
Ah well.  Thanks for trying to help out.

I'm going to attack this from a different angle.  There has to be a way to set 
the device to visible at boot-time.

A2DPvolume is still the #1 app in my books.

Original comment by tryoung...@gmail.com on 18 Jun 2012 at 3:06

GoogleCodeExporter commented 9 years ago
It could be possible to put it into discoverable mode after boot.  This is a 
horrible idea though to have it always discoverable as it hogs CPU resources 
and will drain the battery.  It can also get in the way of automatic 
connections.  

Car makers often to a poor Bluetooth implementation but it sounds like Pioneer 
has even them beat.  

Thanks for the feedback and use cases.  I will ponder this a bit more.  Maybe 
there is a good way to make this work without staying discoverable all the 
time.  Hopefully Pioneer can give a firmware update to fix this bug.  Have you 
contacted them about this?  I would.  

Original comment by JimR...@gmail.com on 18 Jun 2012 at 11:32