I'm trying to write a auto update using Volley library and Dropbox API. I've set it up so that it reads a blog page and finds this chunk of code:
if (response != null) {
boolean resp = response.contains("<div class='post-body entry-content' id='post-body-6791062644900393367' itemprop='description articleBody'>\n" +
"1.1.8\n" +
"<div style='clear: both;'></div>");
Using this code I can say if response is less than 1.1.8 then download the update. I tried to do so using this approach:
if (!resp){My Intent code is here }
but with this code it downloads the update even if the version is up to date.
I've now added the code below to capture the version number. but I cant seam to get my head round how to compare that against either my version in my gradle and to say if less than please update.
Pattern p = Pattern.compile("<div class='post-body entry-content' id='post-body-6791062644900393367' itemprop='description articleBody'>\n" +
"([0-9.]+)\n" +
"<div style='clear: both;'></div>");
Matcher m = p.matcher(response);
if (m.find()) {
String version = m.group();
// more code here
}
Am I doing something wrong or do I need to add more code? I've read I can't use less than it. In this way I have also tried using "<=" comparison. If you think it may be some other piece of my code causing the problem let me know and I can post more for you to see.