I have a service where I "hit" my site every X Minutes and I want compare the "old" jsoup document to the new one to see if there is a change.
Any thoughts / help ?
public class MyService extends Service {
public int onStartCommand(Intent intent, int flags, int startId) {
// Let it continue running until it is stopped.
while(true)
{
new DoBackgroundTask().execute();
return START_STICKY;
}
}
private class DoBackgroundTask extends AsyncTask<String, String, String> {
@Override
protected String doInBackground(String... params) {
String response;
response = "It Run!";
try {
Document results = Jsoup.connect("my site").get();
} catch (IOException e) {
e.printStackTrace();
}
return response;
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
new Handler().postDelayed(new Runnable() {
public void run() {
new DoBackgroundTask().execute();
}
}, 100000);
}
}