How to unsubscribe automatically after receiving onNext() ?
For now I use this code:
rxObservable
.compose(bindToLifecycle()) // unsubscribe automaticall
I you want to "unsubscribe" just after the first event, the operator take
is a way to go.
rxObservable.compose(bindToLifecycle())
.take(1)
.subscribe();
I think this is what you need:
rxObservable.compose(bindToLifecycle())
.takeFirst(lifecycleEvent -> lifecycleEvent == LifecycleEvent.PAUSE);