Reading from a BluetoothGattCharacteristic is failing
<p>Im trying to read the value stored in a <code>BluetoothGattCharacteristic</code>. The following is my <code>BluetoothGattCallback</code> code, where most of the action takes place:</p>

<pre><code> private final BluetoothGattCallback mGattCallback =
            new BluetoothGattCallback() {
                @Override
                public void onConnectionStateChange(BluetoothGatt gatt, int status,
                                                    int newState) {
                    if (newState == BluetoothProfile.STATE_CONNECTED) {
                        Log.i(TAG, "Connected to GATT server.");
                        Log.i(TAG, "Getting services....");
                        gatt.discoverServices();
                    } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
                        Log.i(TAG, "Disconnected from GATT server.");
                    }
                }

                @Override
                public void onServicesDiscovered(BluetoothGatt gatt, int status) {
                    if (status == BluetoothGatt.GATT_SUCCESS) {
                        BluetoothGattService serv = gatt.getService(Constants.MY_UUID);
                        if (serv != null) {
                            BluetoothGattCharacteristic characteristic = serv.getCharacteristic(Constants.ANOTHER_UUID);
                            boolean res = gatt.readCharacteristic(characteristic);
                            if (res) {
                                Log.d(TAG, "res was true");
                            } else {
                                Log.d(TAG, "res was false");
                            }
                        }
                    } else {
                        Log.w(TAG, "onServicesDiscovered received: " + status);
                    }
                }

                @Override
                public void onCharacteristicRead(BluetoothGatt gatt,
                                                 BluetoothGattCharacteristic characteristic,
                                                 int status) {
                    if (status == BluetoothGatt.GATT_SUCCESS) {
                        Log.d(TAG, "Succesfully read characteristic: " + characteristic.getValue().toString());
                    } else {
                        Log.d(TAG, "Characteristic read not successful");
                    }
                }
            };
</code></pre>

<p>So to read from the characteristic, i'm attempting to use the <code>gatt.readCharacteristic()</code> method, which takes a characteristic and returns a boolean indicating a successful operation or not. Here, this method is returning <code>false</code> (printing "res was false"), indicating it failed. </p>

<p>There is no error message being printed. What is the proper way to read a characteristic? Why would this method be returning <code>false</code>?</p>

<p><strong>EDIT:</strong>
As suggested by Inferno, went ahead and downloaded the needed sources and then set a breakpoint in the <code>BluetoothGatt</code> <code>readCharacteristic()</code> method:</p>

<p>Here is the <code>readCharacteristic()</code> method in android-23..\BluetoothGatt</p>

<pre><code>public boolean readCharacteristic(BluetoothGattCharacteristic characteristic) {
        if ((characteristic.getProperties() &amp;
                BluetoothGattCharacteristic.PROPERTY_READ) == 0) return false;
</code></pre>

<p><code>(characteristic.getProperties() &amp; BluetoothGattCharacteristic.PROPERTY_READ)</code> is returning 0 so <code>false</code> is being immediately returned. Now according to the debugger <code>characteristic.getProperties()</code> is returning a value of <code>8</code>, while <code>BluetoothGattCharacteristic.PROPERTY_READ</code> has a static int value of <code>0x02</code>.</p>

<p>As I understand, <code>0x08 &amp; 0x02</code> == 0. Since the <code>PROPERTY_READ</code> is a hardcoded value, I assume something is wrong with the value returned from <code>characteristic.getProperties()</code>. What could be going wrong here?</p>