WeatherInformation: avoid caches
authorgu.martinm@gmail.com <gu.martinm@gmail.com>
Sun, 28 Sep 2014 02:35:30 +0000 (04:35 +0200)
committergu.martinm@gmail.com <gu.martinm@gmail.com>
Sun, 28 Sep 2014 02:35:30 +0000 (04:35 +0200)
src/de/example/exampletdd/NotificationIntentService.java
src/de/example/exampletdd/fragment/current/CurrentFragment.java
src/de/example/exampletdd/fragment/overview/OverviewFragment.java

index f953b53..d544cb9 100644 (file)
@@ -89,7 +89,8 @@ public class NotificationIntentService extends IntentService {
         final String urlAPI = this.getResources().getString(R.string.uri_api_weather_today);
         final String url = weatherService.createURIAPICurrent(urlAPI, APIVersion,
                 weatherLocation.getLatitude(), weatherLocation.getLongitude());
-        final String jsonData = HTTPClient.retrieveDataAsString(new URL(url));
+        final String urlWithoutCache = url.concat("&time=" + System.currentTimeMillis());
+        final String jsonData = HTTPClient.retrieveDataAsString(new URL(urlWithoutCache));
         final Current current = weatherService.retrieveCurrentFromJPOS(jsonData);
         // TODO: what is this for? I guess I could skip it :/
         final Calendar now = Calendar.getInstance();
index 64d83a2..0c2a263 100644 (file)
@@ -498,7 +498,8 @@ public class CurrentFragment extends Fragment {
                final String APIVersion = localContext.getResources().getString(R.string.api_version);
             final String urlAPI = localContext.getResources().getString(R.string.uri_api_weather_today);
             final String url = weatherService.createURIAPICurrent(urlAPI, APIVersion, latitude, longitude);
-            final String jsonData = HTTPClient.retrieveDataAsString(new URL(url));
+            final String urlWithoutCache = url.concat("&time=" + System.currentTimeMillis());
+            final String jsonData = HTTPClient.retrieveDataAsString(new URL(urlWithoutCache));
             final Current current = weatherService.retrieveCurrentFromJPOS(jsonData);
             // TODO: what is this for? I guess I could skip it :/
             final Calendar now = Calendar.getInstance();
index c24bfdd..465279b 100644 (file)
@@ -359,7 +359,8 @@ public class OverviewFragment extends ListFragment {
             final String urlAPI = localContext.getResources().getString(R.string.uri_api_weather_forecast);
             // TODO: number as resource
             final String url = weatherService.createURIAPIForecast(urlAPI, APIVersion, latitude, longitude, "14");
-            final String jsonData = HTTPClient.retrieveDataAsString(new URL(url));
+            final String urlWithoutCache = url.concat("&time=" + System.currentTimeMillis());
+            final String jsonData = HTTPClient.retrieveDataAsString(new URL(urlWithoutCache));
 
             return weatherService.retrieveForecastFromJPOS(jsonData);
         }