Android Bluetooth Connection - Service Discovery Failed

后端 未结 7 1212
情深已故
情深已故 2020-12-17 00:08

I\'m trying to create a basic bluetooth application, for testing the device.

I got the code from developer.android. Here is the link : http://developer.android.com/

7条回答
  •  既然无缘
    2020-12-17 01:04

    Its working for me

    BluetoothSocket socket = device.createInsecureRfcommSocketToServiceRecord(MY_UUID);
    Method m = device.getClass().getMethod("createInsecureRfcommSocket", new Class[] {int.class});
    socket = (BluetoothSocket) m.invoke(device, 1);
    bluetoothAdapter.cancelDiscovery();
    socket.connect();
    

提交回复
热议问题