实现功能:蓝牙配对
在上篇的基础上,配对第一个找到的蓝牙设备
1、重写Handler中找到蓝牙设备后的逻辑
/** 判断是否是第一个发现的蓝牙设备*/
private boolean hasFindOneDevice = false;
case ACTION_FOND:
Intent intentFond = (Intent) msg.obj;
if (!hasFindOneDevice) {
// //连接该蓝牙设备
BluetoothDevice findFirstdevice = intentFond
.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
Log.i(TAG,"第一个发现的蓝牙:" + findFirstdevice.getName());
if (findFirstdevice.getBondState() == BluetoothD