2018-08-09
Android 蓝牙pin自动配对ClsUtils类中的
static public boolean setPin(Class btClass, BluetoothDevice btDevice,
String str){
try{
Method removeBondMethod = btClass.getDeclaredMethod("setPin", new Class[]{byte[].class});
Boolean returnValue = (Boolean) removeBondMethod.invoke(btDevice,
new Object[]{str.getBytes()});
return returnValue.booleanValue();
}catch (Exception e){ e.printStackTrace();return false;
}
}
输入错误的pin 返回也是true,实际蓝牙并没有配对成功 btDevice.getBondState()== BluetoothDevice.BOND_BONDED???为什么,如何解决