title: How to pair Bluetooth device programmatically Android
body: <p>I am developing an application where I want to connect a Bluetooth device main issue is I don't want user to enter required pin instead application should do that by himself...I don't have any connection related issue...Only want to insert and complete pin authentication process by application itself.</p>
  
  <p>I found following code I am sure it is working but not sure on how to add pin in this code??</p>
  
  <pre><code>private void pairDevice(BluetoothDevice device) {
          try {
              Log.d("pairDevice()", "Start Pairing...");
              Method m = device.getClass().getMethod("createBond", (Class[]) null);
              m.invoke(device, (Object[]) null);
              Log.d("pairDevice()", "Pairing finished.");
          } catch (Exception e) {
              Log.e("pairDevice()", e.getMessage());
          }
      }
  </code></pre>
  
  <p>Does anyone know how to enter pin in above code or any similar code to solve problem..
  Thank You</p>