Android学习之Bluetooth开发总结<续3>

1 //取消配对代码:
2 Method m = mTouchObject.bluetoothDevice.getClass().getMethod("removeBond");
3 m.invoke(mTouchObject.bluetoothDevice);
4 //配对代码:初始化socket :
5 Method m = mTouchObject.bluetoothDevice.getClass().getMethod("createRfcommSocket", new Class[] {int.class});
6 temp = (BluetoothSocket) m.invoke(mTouchObject.bluetoothDevice, 1);
7 //socket连接:
8 socket.connect();
原文地址:https://www.cnblogs.com/shuaiwen/p/3492978.html