title: Android BLE: descriptor/characteristic write fails with GATT_WRITE_NOT_PERMITTED
body: <p>From my mobile device(scanner) I am trying to write to a descriptor in a connected wearable(broadcaster).</p>
  
  <p>on the wearable, I have defined the descriptor as</p>
  
  <pre><code>readCharacteristic = new BluetoothGattCharacteristic(Constants.READ_CHAR_UUID,
                              BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY,
                              BluetoothGattCharacteristic.PERMISSION_READ);
  readCharacteristic.addDescriptor(new BluetoothGattDescriptor(Constants.NOTIFY_DESC_UUID,
                          BluetoothGattDescriptor.PERMISSION_READ | BluetoothGattDescriptor.PERMISSION_WRITE));
  </code></pre>
  
  <p>on the mobile, I try to write to the characteristic with</p>
  
  <pre><code>BluetoothGattDescriptor descriptor = readCharacteristic.getDescriptor(Constants.NOTIFY_DESC_UUID);
  descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE)
  </code></pre>
  
  <p>Unfortunately, this fails with status GATT_WRITE_NOT_PERMITTED in</p>
  
  <pre><code>@Override
  public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) {
  
  }
  </code></pre>
  
  <p>In the wearable logcat I see gatts_write_attr_perm_check - GATT_WRITE_NOT_PERMIT.</p>
  
  <p>The same thing happens when I try to write to a characteristic.</p>
  
  <p>What is weird is that the write succeeds when using an iOS scanner. This means that the wearable part is correct.</p>
  
  <p>I have the permissions in the Manifest:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.BLUETOOTH" /&gt;
  &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /&gt;
  &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
  &lt;uses-permission android:name="android.permission.VIBRATE"/&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
  </code></pre>
  
  <p>Devices used:
  Nexus 5x 6.0.1 API 23,
  Moto 360 5.1.1 API 22</p>
  
  <p>Does anyone have an idea how to fix this descriptor/characteristic write issue?</p>