6

Im trying to check if there is a bluetooth headset connected to the device or not

    BluetoothAdapter mAdapter;
    mAdapter = BluetoothAdapter.getDefaultAdapter();
    Log.d("TAG","HEADSET: " + mAdapter.getProfileConnectionState(BluetoothProfile.HEADSET));
    Log.d("TAG","HEALTH: " + mAdapter.getProfileConnectionState(BluetoothProfile.HEALTH));
    Log.d("TAG","A2DP: " + mAdapter.getProfileConnectionState(BluetoothProfile.A2DP));

This is always returning HEADSET 2 (Connected), Health 0 (disconnected) and A2DP 0 (Disconnected). It doesnt matter if I have a bluetooth headset connected or not, headset connection state is 0 only when bluetooth is disabled

JesusS
  • 1,645
  • 1
  • 18
  • 31
  • I know this is very old, but I'm getting all kinds of inaccurate calls from `getProfileConnectionState()` as well. Anyone know anything more about this? – SMBiggs Jun 21 '22 at 21:22

0 Answers0