title: Read values from concrete BLE characteristic Kotlin
body: <p>I'm trying to read values from a concrete BLE characteristic in my app but at the moment I try to read values from the desired characteristic the onCharacteristicRead function seems like not being triggered.</p>
  <p>In very first place i use onServicesDiscovered in order to get every service from the device:</p>
  <pre><code>       override fun onServicesDiscovered(gatt: BluetoothGatt, status: Int) {
  
          Log.e(&quot;BluetoothLeService&quot;, &quot;onServiceDiscovered()&quot;)
          if(status == BluetoothGatt.GATT_SUCCESS){
              Log.i(TAG, &quot;**ACTION_SERVICE_DISCOVERED** $status&quot;)
              var gattServices: List&lt;BluetoothGattService&gt; = mBluetoothGatt!!.services
              Log.e(&quot;onServiceDiscovered&quot;, &quot;Services count: ${gattServices.size}&quot;)
              for(gattService in gattServices){
                  var serviceUUID = gattService.uuid.toString()
                  Log.e(&quot;OnServicesDiscovered&quot;, &quot;Service uuid: $serviceUUID&quot; )
                  readCharacteristic(gattService)
  
              }
              Log.e(&quot;OnServicesDiscovered&quot;, &quot;---------------------------&quot; )
  
              broadcastUpdate( &quot;com.np.lekotlin.ACTION_GATT_SERVICES_DISCOVERED&quot;)
  
          } else {
              //Service discovery failed so log a warning
              Log.i(TAG, &quot;onServicesDiscovered received: $status&quot;)
          }
      }
  </code></pre>
  <p>As you can see I use a for loop in order to achieve every service name and characteristic associated with every service with the readCharacteristic function</p>
  <pre><code>   fun readCharacteristic(service: BluetoothGattService) {
      if (mBluetoothAdapter == null || mBluetoothGatt == null) {
          Log.w(TAG, &quot;BluetoothAdapter not initialized&quot;)
          return
      }
      var gattCharacteristic: List&lt;BluetoothGattCharacteristic&gt; = service.characteristics
      Log.i(TAG, &quot;**LEO LAS ${gattCharacteristic.count()} CARACTERISTICAS DE $service**&quot;)
  
  
      for(characteristic in gattCharacteristic){
          Log.e(&quot;OnServicesDiscovered&quot;, &quot;Service characteristic: ${characteristic.uuid}&quot; )
          if(characteristic.uuid == characteristicRS){
              mBluetoothGatt!!.setCharacteristicNotification(characteristic, true)
              mBluetoothGatt!!.readCharacteristic(characteristic)
          }
      }
      Log.e(&quot;OnServicesDiscovered&quot;, &quot;-----------------------------&quot; )
  }
  </code></pre>
  <p>All this process finally returns me the next result</p>
  <pre><code>E/BluetoothLeService: onServiceDiscovered()
  I/PSoCCapSenseLedService: **ACTION_SERVICE_DISCOVERED** 0
  E/onServiceDiscovered: Services count: 4
  E/OnServicesDiscovered: Service uuid: 00001800-0000-1000-8000-00805f9b34fb
  I/PSoCCapSenseLedService: **LEO LAS 3 CARACTERISTICAS DE android.bluetooth.BluetoothGattService@1b31ffb*
  E/OnServicesDiscovered: Service characteristic: 00002a00-0000-1000-8000-00805f9b34fb
  E/OnServicesDiscovered: Service characteristic: 00002a01-0000-1000-8000-00805f9b34fb
  E/OnServicesDiscovered: Service characteristic: 00002a04-0000-1000-8000-00805f9b34fb
  E/OnServicesDiscovered: -----------------------------
  E/OnServicesDiscovered: Service uuid: 00001801-0000-1000-8000-00805f9b34fb
  I/PSoCCapSenseLedService: **LEO LAS 1 CARACTERISTICAS DE android.bluetooth.BluetoothGattService@4254818**
  E/OnServicesDiscovered: Service characteristic: 00002a05-0000-1000-8000-00805f9b34fb
  -----------------------------
  E/OnServicesDiscovered: Service uuid: 00001814-0000-1000-8000-00805f9b34fb
  I/PSoCCapSenseLedService: **LEO LAS 4 CARACTERISTICAS DE android.bluetooth.BluetoothGattService@a673271**
  E/OnServicesDiscovered: Service characteristic: 00002a53-0000-1000-8000-00805f9b34fb
  Service characteristic: 00002a54-0000-1000-8000-00805f9b34fb
  E/OnServicesDiscovered: Service characteristic: 00002a5d-0000-1000-8000-00805f9b34fb
  Service characteristic: 00002a55-0000-1000-8000-00805f9b34fb
  -----------------------------
  E/OnServicesDiscovered: Service uuid: 0000180a-0000-1000-8000-00805f9b34fb
  I/PSoCCapSenseLedService: **LEO LAS 3 CARACTERISTICAS DE android.bluetooth.BluetoothGattService@3b51856**
  E/OnServicesDiscovered: Service characteristic: 00002a29-0000-1000-8000-00805f9b34fb
  E/OnServicesDiscovered: Service characteristic: 00002a24-0000-1000-8000-00805f9b34fb
  Service characteristic: 00002a27-0000-1000-8000-00805f9b34fb
  E/OnServicesDiscovered: -----------------------------
  ---------------------------
  D/BluetoothGatt: onConnectionUpdated() - Device=00:A0:50:00:00:0F interval=36 latency=0 timeout=500 status=0
  </code></pre>
  <p>Which is completely correct (it displays me every service on the device and every characteristic inside this service), but my problem comes when I try to read values from characteristicRS which is 00002a53-0000-1000-8000-00805f9b34fb, which is correctly reported in the return terminal, but the point is (according to my knowledge) than, in the moment I call</p>
  <pre><code>mBluetoothGatt!!.readCharacteristic(characteristic)
  </code></pre>
  <p>The function</p>
  <pre><code>override fun onCharacteristicRead(
          gatt: BluetoothGatt,
          characteristic: BluetoothGattCharacteristic,
          status: Int
      ) {
          Log.i(TAG, &quot;HAGO COSAS&quot;)
          if (status == BluetoothGatt.GATT_SUCCESS) {
              //See if the read was successful
              Log.i(TAG, &quot;**ACTION_DATA_READ** ${characteristic.uuid}&quot;)
              broadcastUpdate(&quot;com.np.lekotlin.ACTION_DATA_AVAILABLE&quot;/*, characteristic*/)                 //Go broadcast an intent with the characteristic data
              data = characteristic.value
              Log.e(&quot;onCharacteristicRead&quot;, &quot;Datos:&quot;)
              Log.e(&quot;onCharacteristicRead&quot;, &quot;$data&quot;)
  
          } else {
              Log.i(TAG, &quot;ACTION_DATA_READ: Error$status&quot;)
          }
      }
  </code></pre>
  <p>Should be triggered and returning me the values from the characteristic, but is not even entering after all.
  What am I forgetting?</p>
  <p>PD: data is declared as a ByetArray</p>