diff --git a/brouter-routing-app/src/main/java/btools/routingapp/DownloadService.java b/brouter-routing-app/src/main/java/btools/routingapp/DownloadService.java index b067697..94d9a82 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/DownloadService.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/DownloadService.java @@ -192,9 +192,7 @@ public class DownloadService extends Service implements ProgressListener { { try { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - TrafficStats.setThreadStatsTag(1); - } + TrafficStats.setThreadStatsTag(1); int slidx = surl.lastIndexOf( "segments4/" ); String name = surl.substring( slidx+10 ); @@ -397,17 +395,13 @@ public class DownloadService extends Service implements ProgressListener { { try { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - TrafficStats.setThreadStatsTag(1); - } + TrafficStats.setThreadStatsTag(1); + + URL url = new URL(surl); + connection = (HttpURLConnection) url.openConnection(); + connection.setConnectTimeout(5000); + connection.connect(); - if ( connection == null ) - { - URL url = new URL(surl); - connection = (HttpURLConnection) url.openConnection(); - connection.setConnectTimeout(5000); - connection.connect(); - } // expect HTTP 200 OK, so we don't mistakenly save error report // instead of the file if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {