From 18547a3c52d17fa2d079ad94625ff15f585cf771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mieszko=20Wrzeszczy=C5=84ski?= Date: Tue, 1 Jan 2019 20:03:30 +0100 Subject: [PATCH] Remove unnecessary code --- .../service/BackgroundLocalizationService.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java b/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java index aedb4bc..3419925 100644 --- a/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java +++ b/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java @@ -25,7 +25,6 @@ import android.util.Log; import com.annimon.stream.Stream; import com.google.android.gms.location.FusedLocationProviderClient; import com.google.android.gms.location.LocationServices; -import com.jakewharton.retrofit2.adapter.rxjava2.HttpException; import com.mapbox.geojson.Point; import com.mapbox.mapboxsdk.geometry.LatLng; import com.uam.wmi.findmytutor.model.Coordinate; @@ -33,21 +32,17 @@ import com.uam.wmi.findmytutor.network.ApiClient; import com.uam.wmi.findmytutor.utils.ApproximatedLocalization; import com.uam.wmi.findmytutor.utils.MapUtils; import com.uam.wmi.findmytutor.utils.PrefUtils; -import com.uam.wmi.findmytutor.utils.RestApiHelper; import com.uam.wmi.findmytutor.utils.SharingLevel; import org.apache.commons.collections4.queue.CircularFifoQueue; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.atomic.AtomicReference; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.observers.DisposableCompletableObserver; -import io.reactivex.observers.DisposableSingleObserver; import io.reactivex.schedulers.Schedulers; -import okhttp3.ResponseBody; import static com.uam.wmi.findmytutor.utils.Const.offlineBackgroundLocationInterval; import static com.uam.wmi.findmytutor.utils.Const.onlineBackgroundLocationInterval; @@ -60,18 +55,14 @@ import static java.lang.String.valueOf; public class BackgroundLocalizationService extends Service { private static final String TAG = "MyLocationService"; - private static final float LOCATION_DISTANCE = 1f; private static long notify_interval = onlineBackgroundLocationInterval; private static long notify_interval_inside_building = onlineBackgroundLocationInterval; private static long notify_interval_outside_building = offlineBackgroundLocationInterval; private static int coordinatesHistoryLength = 5; - private static final Long LOCATION_INTERVAL = notify_interval; private Location mLastLocation; private Boolean stopService = false; private ArrayList providers = new ArrayList(); - private LocationListener[] mLocationListeners; private CircularFifoQueue coordinatesHistory = new CircularFifoQueue(coordinatesHistoryLength); - private LocationManager mLocationManager = null; private Handler mHandler = new Handler(); private Runnable mStatusChecker; private FusedLocationProviderClient mFusedLocationClient; @@ -80,12 +71,6 @@ public class BackgroundLocalizationService extends Service { providers.add(LocationManager.GPS_PROVIDER); providers.add(LocationManager.NETWORK_PROVIDER); providers.add(LocationManager.PASSIVE_PROVIDER); - - mLocationListeners = new LocationListener[]{ - new LocationListener(LocationManager.GPS_PROVIDER), - new LocationListener(LocationManager.NETWORK_PROVIDER), - new LocationListener(LocationManager.PASSIVE_PROVIDER) - }; } @Override @@ -130,6 +115,7 @@ public class BackgroundLocalizationService extends Service { try { mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this); getLocalizationFromListeners(); + changeBackgroundMode(); } finally { mFusedLocationClient = null; destroyLocationListeners(); -- 2.20.1