我在网上看到有这么一段代码用来判断蓝牙耳机是否链接上了
- private void handleHeadsetStateChange()
- {
- Intent intent = new Intent(Intent.ACTION_HEADSET_PLUG);
- if(BluetoothProfile.STATE_CONNECTED == adapter.getProfileConnectionState(BluetoothProfile.HEADSET))
- {
- intent.putExtra("state", 1);
- intent.putExtra("microphone", 1);
- mContext.sendBroadcast(intent);
- }
- else if(BluetoothProfile.STATE_DISCONNECTED == adapter.getProfileConnec