It is necessary every 30 seconds to download data from the server and process them in a certain way. (Used by retrofit2 for requests to the server). There are no problems with sending single requests to the server, but I don’t know how to send a request every 30 seconds, I ask for your help.
ps Yesterday I asked the same question, the respondent offered to implement it through the Service , BroadcastReceiver ended up with such an innocent action as downloading data from the server every x seconds resulted in a few hundred lines of code, although I’m sure that rxJava can still do this as a corny 1 - 2 operators.
Observable.intervalwhich will perform the necessary timing action, it will work while someone is subscribed to it. I used it inFragment, and it worked, even when moving to another fragment, so I had to unsubscribe toonDestroyView. True, I'm not sure that such use of interval is safe at all, and will most likely cause a memory leak. - DanilObservable, but in the service. And it is better for such tasks (more economical in terms of resources and more reliable) to use FirebaseJobDispatcher. - Vladimir Parfenov