Hi All, I am new to Rx world and stuck into implem...
# rx
k
Hi All, I am new to Rx world and stuck into implementing polling mechanism in RxJava2 for Android. I have to call a webservice max x times and at the interval of y seconds on the success or failure of that webservice. By interval I mean wait for y seconds before making another call. For network call call back mechanism is being used.I also need to show UI based on servive response.Can someone here can help me in implementing the same? It would be highly appreciated.
c
Using Firebase for something like this is much more performant, and more importantly less error prone
Or some cloud messaging solution
j
You can use interval operator
something like JobScheduler/WorkManager might be more appropriate though
u
Observable.interval { }.flatmap { requestObservable } good luck
c
When I say error prone, I mean polling gone wrong can wreak havoc on your server costs, and cloud messaging is going to respond much faster than polling anyways.
j
@Casey Kulm I think you are generally correct but unsure about op's requirements. firebase is a complete solution. My current project for example firebase was not a option for various reasons