title: RxAndroidBle - Long write and listen to notification characteristic
body: <p>I'm very new when it comes to the android / BLE space. I'm attempting to write to a characteristic and listen on the notification using the RxAndroidBle library. I've looked at many implementations that just seem to be different enough that I can't get my scenario to work properly. This post: <a href="https://stackoverflow.com/questions/52916457/no-notification-data-in-write-notification-set-up">No notification data in Write/Notification set-up</a> is almost what I need however, when I use the code posted, I'm unable to capture any data on my peripheral, which in turn doesn't return a response since I'm not sending back a response. When I switch to a long write builder I'm able to write to my peripheral and see the data flow in, but upon returning a response from my peripheral, nothing is captured in my notification subscription.</p>
  
  <p>Here's my code:</p>
  
  <pre><code> private void writeNotify(RxBleDevice peripheral, byte[] payload) {
      Disposable connectionSubscription = peripheral.establishConnection(false)
              .flatMap( // when the connection is available...
                      rxBleConnection -&gt; rxBleConnection.setupNotification(UUID.fromString(notifyCharacteristic)), // ... setup the notification...
                      (rxBleConnection, notifyObservable) -&gt; Observable.combineLatest( // ... when the notification is setup...
                              rxBleConnection.createNewLongWriteBuilder().setBytes(payload).setCharacteristicUuid(UUID.fromString(writecharateristic)).setMaxBatchSize(20).build(), // ... write the characteristic...
                              //rxBleConnection.writeCharacteristic(UUID.fromString(writecharateristic), payload).toObservable(), // ... write the characteristic...
                              notifyObservable, // ... and observe for the first notification on the AP_SCAN_DATA
                              (writtenBytes, responseBytes) -&gt; responseBytes
                      )
              )
              .flatMap(observable -&gt; observable) // ... flatMap the result as it is Observable&lt;byte[]&gt;...// ... and finish after first response is received to cleanup notifications
              .observeOn(AndroidSchedulers.mainThread())
              .subscribe(
                      responseBytes -&gt; {
                          String data = new String(responseBytes);
                      },
                      throwable -&gt; {
  
                      }
              );
  }
  </code></pre>
  
  <p>Separately, I've attempted to handle this as 2 operations where I set up my notification characteristic after performing a long write to my peripheral. Where I subscribe to the observeConnectionStateChanges method on my peripheral and wait for the disconnecting state to fire before setting up my notification characteristic. In this scenario I actually am able to receive partial responses so I know that the notification characteristic is working. I'm just not implementing this correctly. Any suggestions?</p>