我试图检查是否有蓝牙耳机连接到设备
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));
这总是返回HEADSET 2(已连接),Health 0(已断开连接)和A2DP 0(已断开连接)。无论是否连接了蓝牙耳机都没关系,只有当蓝牙被禁用时,耳机连接状态才为0