I have a webservice Api which return an observable and I want to call it every 10 seconds with the option to stop and resume and totally unsubscribe. Is there any example or hint to follow.
Note: I am not an RxJava expert.
If you want an
Observable that emits every 10 seconds, use
interval(). If you want to keep the timer but ignore some events (“stop and resume”), add a
filter() that filters events based on your stop/resume state. To “totally unsubscribe”, dispose the
Disposable that you get when you
subscribe() to the Rx chain.
Thank you very much indeed for ur fast reply. I believe that filter will call the webservice and will not stop, so I may unsubscribe and resubscribe
If you put the filter between the
interval() and the
flatMap() (or whatever you are doing to chain in the Web service call), then the Web service would not be called when the
it worked, thank you very much indeed