title: my Bluetooth cannot connect to the device
body: <p>i am trying to use my android phone to connect to the pc or hc01 but know the code that i write cannot connect to the phone now so anyone can help me out
  and the UUID what should i use or have anyone have some demon for me to try out 
  thanks</p>
  
  <p>i don't why i click and it always connect fail and the logcat will get</p>
  
  <pre><code>com.example.lord1.myapplication123123 W/BluetoothAdapter: getBluetoothService() called with no BluetoothManagerCallback
  </code></pre>
  
  <p>this is my code:</p>
  
  <pre><code>private void discover(View view){
      // Check if the device is already discovering
      if(mBTAdapter.isDiscovering()){
          mBTAdapter.cancelDiscovery();
          Toast.makeText(getApplicationContext(),"Discovery stopped",Toast.LENGTH_SHORT).show();
      }
      else{
          if(mBTAdapter.isEnabled()) {
              mBTArrayAdapter.clear(); // clear items
              mBTAdapter.startDiscovery();
              Toast.makeText(getApplicationContext(), "Discovery started", Toast.LENGTH_SHORT).show();
              registerReceiver(blReceiver, new IntentFilter(BluetoothDevice.ACTION_FOUND));
          }
          else{
              Toast.makeText(getApplicationContext(), "Bluetooth not on", Toast.LENGTH_SHORT).show();
          }
      }
  }
  
  final BroadcastReceiver blReceiver = new BroadcastReceiver() {
      @Override
      public void onReceive(Context context, Intent intent) {
          String action = intent.getAction();
          if(BluetoothDevice.ACTION_FOUND.equals(action)){
              BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
              // add the name to the list
              mBTArrayAdapter.add(device.getName() + "\n" + device.getAddress());
              mBTArrayAdapter.notifyDataSetChanged();
  
          }
  
      }
  };
  
  private void listPairedDevices(View view){
      mPairedDevices = mBTAdapter.getBondedDevices();
      if(mBTAdapter.isEnabled()) {
          // put it's one to the adapter
          for (BluetoothDevice device : mPairedDevices)
              mBTArrayAdapter.add(device.getName() + "\n" + device.getAddress());
  
          Toast.makeText(getApplicationContext(), "Show Paired Devices", Toast.LENGTH_SHORT).show();
      }
      else
          Toast.makeText(getApplicationContext(), "Bluetooth not on", Toast.LENGTH_SHORT).show();
  }
  
  private AdapterView.OnItemClickListener mDeviceClickListener = new AdapterView.OnItemClickListener() {
      public void onItemClick(AdapterView&lt;?&gt; av, View v, int arg2, long arg3) {
  
          if(!mBTAdapter.isEnabled()) {
              Toast.makeText(getBaseContext(), "Bluetooth not on", Toast.LENGTH_SHORT).show();
              return;
          }
  
          mBluetoothStatus.setText("Connecting...");
          // Get the device MAC address, which is the last 17 chars in the View
          String info = ((TextView) v).getText().toString();
          final String address = info.substring(info.length() - 17);
          final String name = info.substring(0,info.length() - 17);
  
          // Spawn a new thread to avoid blocking the GUI one
          new Thread()
          {
              public void run() {
                  boolean fail = false;
  
                  BluetoothDevice device = mBTAdapter.getRemoteDevice(address);
  
                  try {
                      mBTSocket = createBluetoothSocket(device);
                  } catch (IOException e) {
                      fail = true;
                      Toast.makeText(getBaseContext(), "Socket creation failed", Toast.LENGTH_SHORT).show();
                  }
                  // Establish the Bluetooth socket connection.
                  try {
                      mBTSocket.connect();
                  } catch (IOException e) {
                      try {
                          fail = true;
                          mBTSocket.close();
                          mHandler.obtainMessage(CONNECTING_STATUS, -1, -1)
                                  .sendToTarget();
                      } catch (IOException e2) {
                          //insert code to deal with this
                          Toast.makeText(getBaseContext(), "Socket creation failed", Toast.LENGTH_SHORT).show();
                      }
                  }
                  if(fail == false) {
                      mConnectedThread = new ConnectedThread(mBTSocket);
                      mConnectedThread.start();
  
                      mHandler.obtainMessage(CONNECTING_STATUS, 1, -1, name)
                              .sendToTarget();
                  }
              }
          }.start();
      }
  };
  </code></pre>