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();

 

posted @ 2013-12-26 20:02  Shuaiwen8023  阅读(249)  评论(0编辑  收藏  举报