isBluetoothA2dpOn not working correctly

Go To StackoverFlow.com

2

I've got a service that is used during phone calls and I am trying to find out if a bluetooth headset is connected. But when I use am.isBluetoothA2dpOn() it always returns false. During phone calls, not during phone calls, all the time!

Here's a sample of what I'm doing:

AudioManager am = (AudioManager) getSystemService(AUDIO_SERVICE);
if(am.isBluetoothA2dpOn())
{
    Log.v(TAG, "Bluetooth headset is connected!");
}

I am also using the following permissions in the AndroidManifest.xml

<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.BLUETOOTH" />

Also: am.isWiredHeadsetOn() works just fine!?!

The bluetooth device is connected and I can use it just like it's meant to be used. So any help would be great.

2012-04-05 23:46
by Matthew


0

You want to check isBluetoothScoOn() rather than A2DP

A2DP is primarily for music and games, high quality audio. Advanced Audio Distribution Profile.

2012-06-07 19:52
by Mike dg
unfortunatly this doesn't seem to work either, I tested both am.isBluetoothA2dpOn || am.isBluetoothScoOn with no positive results. Not sure what I am doing wrong but it doesn't seem like it should be this difficult ; - Matthew 2012-07-07 16:55
Pancake345: weird, at least when I wrote this I was pretty sure I tested that. Hmmm - Mike dg 2012-07-09 12:26


0

There's a problem with isWiredHeadsetOn() that causes it to return false (but not crash or raise an exception) if you don't have android.permission.MODIFY_AUDIO_SETTINGS

I'd advise to check if this same permission is necessary for isBluetoothA2dpOn()

2013-05-29 17:09
by jmng
Ads