title: Why does setCharacteristicNotification() not actually enable notifications?
body: <p>The <code>BluetoothLeGatt</code> Android BLE example contains the following code:</p>
  
  <pre><code>public void setCharacteristicNotification(BluetoothGattCharacteristic characteristic,
                                            boolean enabled) {
      if (mBluetoothAdapter == null || mBluetoothGatt == null) {
          Log.w(TAG, "BluetoothAdapter not initialized");
          return;
      }
      mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);
  
      // This is specific to Heart Rate Measurement.
      if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) {
          BluetoothGattDescriptor descriptor = characteristic.getDescriptor(
                  UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
          descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
          mBluetoothGatt.writeDescriptor(descriptor);
      }
  }
  </code></pre>
  
  <p>My question is basically, why is the marked code specific to Heart Rate Measurement? It seems like having a Client Characteristic Config Descriptor (CCCD) characteristic is the standard way to control characteristic notification, so why doesn't <code>setCharacteristicNotification()</code> take care of writing to it? And since it doesn't do that, what does <code>setCharacteristicNotification()</code> actually do?</p>
  
  <p>I'm pretty new to BLE and there aren't any explanations of it on the internet that don't assume that you already understand it all! So don't assume I know what a CCCD or whatever is! It was difficult enough finding out what CCCD even stands for!</p>
  
  <p>Edit: See also this answer which supports my understanding of CCCDs (and makes me continue to wonder why you have to write to them manually in Android when there is a function that <em>looks</em> like it should do that for you): <a href="https://devzone.nordicsemi.com/index.php/what-does-cccd-mean" rel="noreferrer">https://devzone.nordicsemi.com/index.php/what-does-cccd-mean</a></p>