diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java index d5d34876..d9ec6d26 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java @@ -37,7 +37,6 @@ public class GetTask extends AsyncTask { HttpClient httpclient = new DefaultHttpClient(); HttpGet get = new HttpGet(fullUri); get.addHeader(new BasicHeader("X-API-Key", params[2])); - String responseString = null; try { HttpResponse response = httpclient.execute(get); HttpEntity entity = response.getEntity(); diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/PostTask.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/PostTask.java index ce1534ce..dfe9cf0d 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/PostTask.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/PostTask.java @@ -32,9 +32,8 @@ public class PostTask extends AsyncTask { HttpClient httpclient = new DefaultHttpClient(); HttpPost post = new HttpPost(fullUri); post.addHeader(new BasicHeader("X-API-Key", params[2])); - String responseString = null; try { - HttpResponse response = httpclient.execute(post); + httpclient.execute(post); } catch (IOException e) { Log.w(TAG, "Failed to call Rest API at " + fullUri, e); diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java index 75b1b795..23bd4d80 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java @@ -326,6 +326,10 @@ public class SyncthingService extends Service { finally { mApi = new RestApi("http://" + syncthingUrl, apiKey); Log.i(TAG, "Web GUI will be available at " + mApi.getUrl()); + // HACK: Make sure there is no syncthing binary left running from an improper + // shutdown (eg Play Store update). + // NOTE: This will log an exception if syncthing is not actually running. + new PostTask().execute(mApi.getUrl(), PostTask.URI_SHUTDOWN); registerOnWebGuiAvailableListener(mApi); } new PollWebGuiAvailableTask().execute();