Android 安卓;“服务发现失败”;使用androbox蓝牙连接诺基亚Lumia手机时出现异常

Android 安卓;“服务发现失败”;使用androbox蓝牙连接诺基亚Lumia手机时出现异常,android,bluetooth,Android,Bluetooth,在Android BluetoothChat程序行中 tmp = device.createRfcommSocketToServiceRecord(MY_UUID_SECURE); Method m = device.getClass().getMethod("createRfcommSocket",new Class[] { int.class }); tmp = (BluetoothSocket) m.invoke(device

在Android BluetoothChat程序行中

      tmp = device.createRfcommSocketToServiceRecord(MY_UUID_SECURE);
            Method  m = device.getClass().getMethod("createRfcommSocket",new Class[] { int.class });
            tmp = (BluetoothSocket) m.invoke(device, 1);
显示“服务发现失败”异常

      private static final UUID MY_UUID_SECURE = UUID
        .fromString("00001101-0000-1000-8000-00805F9B34FB");


      public ConnectThread(BluetoothDevice device, boolean secure) {
        mmDevice = device;
        BluetoothSocket tmp = null;
        mSocketType = secure ? "Secure" : "Insecure";

        // Get a BluetoothSocket for a connection with the
        // given BluetoothDevice
        try {
            if (secure) {
                tmp = device.createRfcommSocketToServiceRecord(MY_UUID_SECURE);
            } else {
                tmp = device.createInsecureRfcommSocketToServiceRecord(MY_UUID_INSECURE);
            }
        } catch (Exception e) {
            Log.e(TAG, "Socket Type: " + mSocketType + "create() failed", e);
        }
        mmSocket = tmp;
    }

    public void run() {
        Log.i(TAG, "BEGIN mConnectThread SocketType:" + mSocketType);
        setName("ConnectThread" + mSocketType);

        // Always cancel discovery because it will slow down a connection
        mAdapter.cancelDiscovery();

        // Make a connection to the BluetoothSocket
        try {
            // This is a blocking call and will only return on a
            // successful connection or an exception
            mmSocket.connect();
        } catch (IOException e) {
            try {
                mmSocket.close();
            } catch (IOException e2) {
                Log.e(TAG, "unable to close() " + mSocketType
                        + " socket during connection failure", e2);
            }
            connectionFailed();
            return;
        }

        // Reset the ConnectThread because we're done
        synchronized (BluetoothChatService.this) {
            mConnectThread = null;
        }

        // Start the connected thread
        connected(mmSocket, mmDevice, mSocketType);
    }
            Method  m = device.getClass().getMethod("createRfcommSocket",new Class[] { int.class });
            tmp = (BluetoothSocket) m.invoke(device, 1);
这里是mmSocket.connect();未连接并显示“服务发现失败”异常

            Method  m = device.getClass().getMethod("createRfcommSocket",new Class[] { int.class });
            tmp = (BluetoothSocket) m.invoke(device, 1);
我试过了

            Method  m = device.getClass().getMethod("createRfcommSocket",new Class[] { int.class });
            tmp = (BluetoothSocket) m.invoke(device, 1);
但同样的例外正在到来。请告诉我可能的解决办法

            Method  m = device.getClass().getMethod("createRfcommSocket",new Class[] { int.class });
            tmp = (BluetoothSocket) m.invoke(device, 1);