title: Subscribe to a characteristic and catch the value Android
body: <p>I´m developing an BLE app, based on the Gatt sample project provided by google: <a href="https://developer.android.com/samples/BluetoothLeGatt/index.html" rel="nofollow noreferrer">https://developer.android.com/samples/BluetoothLeGatt/index.html</a>. So, I can send data writing in a characteristic successfully. Now I need to know when this characteristic change its value.</p>
  
  <p><strong>DeviceActivity</strong></p>
  
  <pre><code>private void displayGattServices(List&lt;BluetoothGattService&gt; gattServices) 
  {
     // get services &amp; characteristics
     ................ 
  
  final BluetoothGattCharacteristic characteristic = mGattCharacteristics.get(2).get(0);
          final int charaProp = characteristic.getProperties();
          mWriteCharacteristic = characteristic;
          mBluetoothLeService.setCharacteristicNotification(mWriteCharacteristic, true);
  
     // write in the characteristic to send a reset command to BLE device
  
     // Start the read method, that permit subscribe to the characteristic
     BluetoothLeService.read(mWriteCharacteristic);
     BluetoothLeService.set(mWriteCharacteristic,true);
  };
  </code></pre>
  
  <p><strong>BluetoothLeService</strong></p>
  
  <pre><code>public static void read(BluetoothGattCharacteristic characteristic) 
       {
          if (mBluetoothAdapter == null || mBluetoothGatt == null) 
          {
              Log.w("BluetoothAdapter not initialized");
              return;
          };
  
          mBluetoothGatt.readCharacteristic(characteristic);
      };
  
      public static void set(BluetoothGattCharacteristic characteristic, boolean enabled) 
      {
          if(mBluetoothAdapter == null || mBluetoothGatt == null) 
          {
              Log.w("BluetoothAdapter not initialized");
              return;
          };
  
          mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);
  
          UUID uuid = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
          BluetoothGattDescriptor descriptor = characteristic.getDescriptor(uuid);
          descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
          mBluetoothGatt.writeDescriptor(descriptor);
      };
  </code></pre>
  
  <p>But I dont know how can I catch the value of the read characteristic. Actually, I dont know if my code subscribe succesful to the characteristic or not. Some one can help me? How can I check if the value of the characteristic change really? And how can I display the new value of this characteristic in the screen? Is correct my code or I need add, modify or remove something?
  Thaks in advance.
  I guide by this question: <a href="https://stackoverflow.com/questions/25855501/reading-multiple-characteristics-from-a-ble-device-synchronously-recommended-me">Reading multiple characteristics from a BLE device synchronously (Recommended Method for Android)</a></p>