diff --git a/app/src/apiOreo/java/foundation/e/blisslauncher/features/weather/WeatherUpdateService.java b/app/src/apiOreo/java/foundation/e/blisslauncher/features/weather/WeatherUpdateService.java index 02af6ea1a7ac6759cffbaa1d20f5e052d0007941..1247940107f09676e68be874e593eeeb3f6cb3a2 100644 --- a/app/src/apiOreo/java/foundation/e/blisslauncher/features/weather/WeatherUpdateService.java +++ b/app/src/apiOreo/java/foundation/e/blisslauncher/features/weather/WeatherUpdateService.java @@ -34,7 +34,6 @@ import java.util.Date; import foundation.e.blisslauncher.R; import foundation.e.blisslauncher.core.Preferences; import foundation.e.blisslauncher.core.utils.Constants; -import foundation.e.blisslauncher.core.utils.PackageManagerUtils; import lineageos.weather.LineageWeatherManager; import lineageos.weather.WeatherInfo; import lineageos.weather.WeatherLocation; @@ -60,7 +59,7 @@ public class WeatherUpdateService extends Service { private static final long LOCATION_REQUEST_TIMEOUT = 5L * 60L * 1000L; // request for at most 5 minutes private static final long OUTDATED_LOCATION_THRESHOLD_MILLIS = 10L * 60L * 1000L; // 10 minutes - private static final float LOCATION_ACCURACY_THRESHOLD_METERS = 50000; + private static final float LOCATION_ACCURACY_THRESHOLD_METERS = 5000; private WorkerThread mWorkerThread; private Handler mHandler; @@ -69,8 +68,7 @@ public class WeatherUpdateService extends Service { static { sLocationCriteria = new Criteria(); - sLocationCriteria.setPowerRequirement(Criteria.POWER_LOW); - sLocationCriteria.setAccuracy(Criteria.ACCURACY_COARSE); + sLocationCriteria.setAccuracy(Criteria.ACCURACY_FINE); sLocationCriteria.setCostAllowed(false); } @@ -323,7 +321,7 @@ public class WeatherUpdateService extends Service { }catch (SecurityException e){ e.printStackTrace(); } - if (D) Log.v(TAG, "Current location is " + location); + if (D) Log.v(TAG, "Current location is " + location + ", accuracy: " + location.getAccuracy()); if (location != null && location.getAccuracy() > LOCATION_ACCURACY_THRESHOLD_METERS) { if (D) Log.d(TAG, "Ignoring inaccurate location"); @@ -343,11 +341,6 @@ public class WeatherUpdateService extends Service { String locationProvider = lm.getBestProvider(sLocationCriteria, true); if (TextUtils.isEmpty(locationProvider)) { Log.e(TAG, "No available location providers matching criteria."); - } else if (PackageManagerUtils.isAppInstalled(mContext, "com.google.android.gms") - && locationProvider.equals(LocationManager.GPS_PROVIDER)) { - // Since Google Play services is available, - // let's conserve battery power and not depend on the device's GPS. - Log.i(TAG, "Google Play Services available; Ignoring GPS provider."); } else { WeatherLocationListener.registerIfNeeded(mContext, locationProvider); }