title: Bluetooth host not detecting incoming connections
body: <p>I want to connect two cell phones using bluetooth with one of them being the host(listening for connections) and the other one initiating the connection. The code that initiates the connection works well and gets successfully connected to the other phone. </p>
  
  <p>However the host gets stuck at socket.accept() because it doesn't detect the connection. The UUIDs are the same on both devices so I really have no clue about what the porblem is.</p>
  
  <p>Here's the AcceptThread of the host:</p>
  
  <pre><code>private class AcceptThread extends Thread {
      // The local server socket
      private final BluetoothServerSocket mmServerSocket;
  
      boolean running = true;
  
      public AcceptThread() {
          BluetoothServerSocket tmp = null;
  
          // Create a new listening server socket
          try {
              tmp = mAdapter.listenUsingRfcommWithServiceRecord(NAME_SECURE, MY_UUID_SECURE);
          } catch (IOException e) {
              running = false;
  
              Toast.makeText(getApplicationContext(), "socket failed: " + e.getMessage(), Toast.LENGTH_SHORT).show();
          }
          mmServerSocket = tmp;
      }
  
      public void run() {
  
          setName("AcceptThread");
  
          BluetoothSocket socket = null;
  
          int state = getMState();
  
          // Listen to the server socket if we're not connected
          while (running) {
              try {
                  // This is a blocking call and will only return on a
                  // successful connection or an exception
  
                  socket = mmServerSocket.accept();
              } catch (IOException e) {
                  break;
              }
  
              // If a connection was accepted
              if (socket != null) {
                  setState(STATE_CONNECTED);
  
                  Toast.makeText(getApplicationContext(), "Connected to: " + socket.getRemoteDevice().getName(), Toast.LENGTH_SHORT).show();
                  startConnectedThread(socket);
              }
          }
  
      }
  </code></pre>
  
  <p>I can assure you the UUIDs that the both devices are using are the same: 00001101-0000-1000-8000-00805f9b34fb</p>
  
  <p>Also I was testing this app on an older phone that has API Level lower than 15(as the host) and another phone(initiating) with API level 17. Can that cause connection issues??</p>