Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 591 Bytes

README.md

File metadata and controls

16 lines (12 loc) · 591 Bytes

AndroidRxDemo

doOnTerminate vs doOnUnsubscribe

doOnUnsubscribe is only in RX1. In RX2, it is similar to (doOnDispose ReactiveX/RxJava#4811) but it different

Observable completion/error

  • doOnTerminate called
  • doOnUnsubscribe called

Programatic call to unsubscribe before Observable completes (subscribe.unsubscribe())

  • doOnTerminate don't called
  • doOnUnsubscribe called

=> In RX1, if we want to detect something run after stream finished by anyway, we should use doOnUnsubscribe => In RX2, we can use doOnFinish method