title: Can we pair BLE Device the same way as we pair Classic Bluetooth Device?
body: <p>I am using the same code for <code>Bluetooth Low Energy (BLE)</code> to pair the devices as I used for <code>Classic bluetooth</code> pairing. I am not sure that the code will work for BLE or not as I am not having BLE device to test at the moment or later (only client can test).</p>
  
  <p><strong>My code for Bluetooth Classic pairing</strong> -</p>
  
  <pre><code>@Override
      protected void onListItemClick(ListView l, View v, int position, long id) {
          final BluetoothDevice device = mLeDeviceListAdapter.getDevice(position);
          if (device == null) return;
  
          Boolean isBonded = false;
          try {
              isBonded = createBond(device);           
          } catch (Exception e) {
              e.printStackTrace(); 
          }
          Log.i("Log", "The bond is created: "+isBonded);
  }
  
  public boolean createBond(BluetoothDevice btDevice)  
      throws Exception  
      { 
          Class class1 = Class.forName("android.bluetooth.BluetoothDevice");
          Method createBondMethod = class1.getMethod("createBond");  
          Boolean returnValue = (Boolean) createBondMethod.invoke(btDevice);  
          return returnValue.booleanValue();  
      }
  </code></pre>
  
  <p>Here each list item is the device that needs to be bonded.</p>
  
  <p>So we click on the item and then it gets bonded by the above code. (<em>This is for Classic Bluetooth Pairing</em>).</p>
  
  <p>Does the same code work for BLE pairing ?</p>
  
  <p>I haven't found any pairing code for BLE devices or any online/official stuff related to their pairing. That's strange.</p>