1

I am trying to extract information from observable with flatMap but it won't call subscribe after that. When I return Observable.just(it) from flatMap subscribe is called as expected but then I am not able to get the information.

conn.setupNotification(UUID_GATT_DFU_DEVICE_FIRMWARE_UPDATE_STATUS, NotificationSetupMode.COMPAT)
                .subscribeOn(Schedulers.newThread())
                .doOnNext{
                    Timber.d("this is called")
                }
                .flatMap {
                    Timber.d("this is called")
                    //Observable.just(it) with this subscribe is called
                    it
                }
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(
                    { status ->
                        Timber.d("NOTIFY RESPONSE STATUS: @@@ $status")
                    },
                    {
                        Timber.d(it)
                    },
                    {
                        Timber.d("ON COMPLETE notify observer")
                    }
                ).also {
                    notificationDisposable.add(it)
                }

what am I doing wrong? I need to extract the observable but how when flatMap doesn't work as expected? I also tried another subscribe in onNext method but it also didn't work.

Lazar Momcilovic
  • 333
  • 2
  • 12
Kebab Krabby
  • 1,574
  • 13
  • 21

0 Answers0