title: Unable to accept incoming Bluetooth connection in Android
body: <p>Maybe similar to the unanswered thread <a href="https://stackoverflow.com/questions/5814024/android-bluetooth-service-socket-never-accepts-incoming-connection">here</a>, but we have an Android application (tested on multiple handsets and multiple Android 2.1+ versions) which needs to listen for and accept connections from a remote bluetooth device. The remote device is a digital pen, but the main point is that the pen is paired with the phone and then sends data via SPP, which uses OBEX, which uses RFComm so all that should be fine.</p>
  
  <p>Currently the application works by allowing the Android device to receive the OBEX payload and then get the app to look in the bluetooth folder to pick up the payload, but we want the application to be able to talk directly to the remote device. <em>Keep in mind the remote connects to the android phone, the phone does not connect to the pen.</em></p>
  
  <p>Our test code is based on the sample BluetoothChat application available in the Android samples, but essentially <code>adapter.listenUsingRfcommWithServiceRecord</code> never gets called and the best that we see in the <strong>Motorola Defy+</strong> DDMS logs is:</p>
  
  <pre><code>INFO/BtOppRfcommListener(2577): Accepted connectoin from 00:07:CF:55:94:FB
  INFO/BtOpp Service(2577): Start Obex Server
  DEBUG/Obex ServerSession(2577): java.io.IOException: Software caused connection abort
  </code></pre>
  
  <p>This appears to show that the connection is accepted by Android but not made available to the application. The UUID used is the same UUID used in the JME version of the same application and was provided by the pen supplier.</p>