我正在为我正在开发的应用程序提供一些帮助。
简而言之,在我的应用程序中,我将通过蓝牙连接到一个设备(由客户的工程团队开发)以从该设备获取数据。
我使用以下代码进行蓝牙连接。
BluetoothDevice btDevice = _btAdapter.getRemoteDevice(address);
m = btDevice.getClass().getMethod("createRfcommSocket", new Class[]{int.class});
sock = (BluetoothSocket)m.invoke(btDevice, Integer.valueOf(1));
sock.connect();
// m is a Method and sock is BluetoothSocket object.
此代码适用于除Motoral Droid x之外的所有设备
这是一个例外:
java.io.ioexception:权限被拒绝。
我在所有论坛中都尝试过,但我找不到适合它的解决方案。
如果有人为此提供解决方案,请帮助我。
提前致谢