Android Devs Substack

Android Devs Substack

Share this post

Android Devs Substack
Android Devs Substack
Loop a Single Until a Condition Becomes True in RxJava

Loop a Single Until a Condition Becomes True in RxJava

Polling Status of a Resource

Murat AYDIN's avatar
Murat AYDIN
Sep 11, 2023
∙ Paid

Share this post

Android Devs Substack
Android Devs Substack
Loop a Single Until a Condition Becomes True in RxJava
Share

Polling is a technique used in software development to check status of a resource at regular intervals. It is usually used to monitor changes in real time data. It is done by making periodic calls to an api. Some real life applications:

  1. Getting the latest geographic position of a device that updates its location in real time.

  2. Making a request or a command to a device and checking whether the change or command is applied successfully.

Polling is not a good approach for getting updates or changes, because it is not using resources efficiently. Suppose there is no change in the resource you are monitoring. In polling you still need to continue polling in such cases, and this is not an efficient way of using resources.

Instead of polling, an event driven approach could be used. In this case, resource is publishing its state updates to the observers. This is a better usage of resources.

Being said that, sometimes you may not use event-driven approach even it is better. For instance, in one of my project, we used polling until event-driven approach is implemented.

In this blog post, I will show two ways of using polling in RxJava.

spiral concrete staircase
Photo by Tine Ivanič on Unsplash

1. Way

Keep reading with a 7-day free trial

Subscribe to Android Devs Substack to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Murat AYDIN
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share