- if (secure) {
- Method m = device.getClass().getMethod("createRfcommSocket", new Class[] {int.class});
- tmp_socket = (BluetoothSocket) m.invoke(device, 2);
- // tmp = device.createRfcommSocket(2);
- } else {
- Method m = device.getClass().getMethod("createInsecureRfcommSocket", new Class[] {int.class});
- tmp_socket = (BluetoothSocket) m.invoke(device, 2);
- // tmp = device.createInsecureRfcommSocket(2);
- }
- } catch (Exception e) {
- Log.e(TAG, "Socket Type: " + mSocketType + "create() failed", e);
+ tmp_socket = device.createInsecureRfcommSocketToServiceRecord(SPP_UUID);
+ } catch (IOException e) {