@@ -0,0 +1,809 @@
+package fr.tvbarthel.apps.simpleweatherforcast.utils;%0A%0A%0Aimport android.app.Service;%0Aimport android.content.Context;%0Aimport android.location.Criteria;%0Aimport android.location.Location;%0Aimport android.location.LocationManager;%0A%0Apublic class LocationUtils %7B%0A%0A%09public static Location getLastKnownLocation(Context context) %7B%0A%09%09Location lastKnownLocation = null;%0A%09%09final LocationManager locationManager = (LocationManager) context.getSystemService(Service.LOCATION_SERVICE);%0A%09%09final Criteria locationCriteria = new Criteria();%0A%09%09locationCriteria.setAccuracy(Criteria.ACCURACY_COARSE);%0A%09%09final String providerName = locationManager.getBestProvider(locationCriteria, true);%0A%09%09if (providerName != null) %7B%0A%09%09%09lastKnownLocation = locationManager.getLastKnownLocation(providerName);%0A%09%09%7D%0A%0A%09%09return lastKnownLocation;%0A%09%7D%0A%7D%0A

Add a LocationUtils to retrieve the last known location.