Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Yes, there's a smarter way to do so, it will require some work on both server and client side though. This is how it works: all data should be available to download in JSON or XML format (I'd rather prefer JSON). So, you will have something like this in the server: <a href="http://example.com/resource.json" rel="noreferrer">http://example.com/resource.json</a>. In order to know if there's a new version of the data, what you can do is adding a header version to the HTTP response (that way you don't have to download and parse the whole resource in order to know if there's a new version).</p> <p>In order for you to check those headers, you will have something like this:</p> <pre><code>URLConnection urlConnection = null; try { urlConnection = url.openConnection(); urlConnection.connect(); String currentVersionHeader = urlConnection.getHeaderField("your-version-header"); if( currentVersionHeader == null ) { currentVersionHeader = "-1"; } int version = Long.parseLong(currentVersionHeader); // then you compare with the old version if( oldVersion &lt; version ){ // download the data } } catch (Exception e) {} </code></pre> <p>Downloading and parsing a JSON resource is something that has been already treated and you will find a bunch of tutorials and references on Google and here.</p> <p>You are not providing details of the server side (is PHP? Java? .NET?), so I also won't give you details of how to implement/add a version header. I'm just explained you what's one the best way to do this kind of things based on my own experience.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload