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.
You want to check isBluetoothScoOn() rather than A2DP
A2DP is primarily for music and games, high quality audio. Advanced Audio Distribution Profile.
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()