Answer the question
In order to leave comments, you need to log in
How to check the availability of sites with the least load?
As a practical task, I want to write an application that will regularly (user-specified period of time) check the availability (200 server response) of a whole list of sites.
I see the algorithm itself as follows: the user adds the sites he needs to the list and sets the regularity of checks in the settings, and the application then makes requests to the site one by one, processing the response. If 200 - put a tick and move on. If 4**, 3**, 5** etc. - we throw out the pop-up.
There are questions about the correct operation of this simple (alas, not for me) application.
Questions
1) How to make requests to get only the server response code? What library or can built-in OS functionality?
2) How to manage the regularity of the check launch? Is there a semblance of a crown for Android?
3) Where is the best place to store added sites and check results?
Answer the question
In order to leave comments, you need to log in
1. Send anything, the main thing is to use HEAD instead of GET
2. You can use ScheduledExecutorService/JobScheduler or find another solution using Google
3. In a database or in a separate file (the easiest way is to encode data in json/xml/csv/etc. and write to file)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question