前言
欢迎大家我分享和推荐好用的代码段~~
正文
private void handleHeadsetStateChange() { if(BluetoothProfile.STATE_CONNECTED == adapter.getProfileConnectionState(BluetoothProfile.HEADSET)) { Intent intent = new Intent(Intent.ACTION_HEADSET_PLUG); sendBroadcast(intent); }