title: Android : Programmatically pair a bluetooth device; Incorrect pin or passkey on some devices?
body: <p><strong>What I want to do :</strong></p>
  
  <p>I'm developping an Android specific app where I must pair a device automatically, without even displaying the usual dialog box to ask the user to input a passcode.</p>
  
  <p>My code is mainly inspired from these two stackOverflow Threads :</p>
  
  <p><a href="https://stackoverflow.com/questions/7537313/auto-accept-bluetooth-pairing-possible">Auto-accept bluetooth pairing possible?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/38055699/programmatically-pairing-with-a-ble-device-on-android-4-4">Programmatically pairing with a BLE device on Android 4.4+</a> </p>
  
  <p><strong>The problem I'm facing :</strong></p>
  
  <ul>
  <li>device #1 on android 5.1.1  : Ok</li>
  <li>device #2 on android 6.0    : Ok</li>
  <li>device #3 on android 5.1    : couldn't pair because of an incorrect pin or passkey</li>
  <li>device #4 on android 5.1    : couldn't pair because of an incorrect pin or passkey</li>
  </ul>
  
  <p>I can't tell if android version has something to do with this issue. Do you have any idea that may help me make it work on devices #3 and #4 ?</p>