From 3e38c07d7d87bc07e2e706c574d2ca91875b4e5b Mon Sep 17 00:00:00 2001 From: GalateeM Date: Fri, 10 May 2024 10:14:47 +0200 Subject: [PATCH 1/2] Bug #457 - Use of GnssStatus --- .../android/whereyougo/geo/location/GpsConnection.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/menion/android/whereyougo/geo/location/GpsConnection.java b/src/main/java/menion/android/whereyougo/geo/location/GpsConnection.java index 2efb0f6c..3f3b4285 100644 --- a/src/main/java/menion/android/whereyougo/geo/location/GpsConnection.java +++ b/src/main/java/menion/android/whereyougo/geo/location/GpsConnection.java @@ -44,12 +44,14 @@ public class GpsConnection { private final MyLocationListener llGPS; private final MyLocationListener llNetwork; private final MyGpsListener gpsListener; + private final MyGnssListener gnssListener; private boolean isFixed; private Timer mGpsTimer; // temp variable for indicating whether network provider is enabled private boolean networkProviderEnabled; private boolean gpsProviderEnabled; private GpsStatus gpsStatus; + private GnssStatus gnssStatus; public GpsConnection(Context context) { Logger.w(TAG, "onCreate()"); @@ -58,6 +60,7 @@ public GpsConnection(Context context) { llGPS = new MyLocationListener(); llNetwork = new MyLocationListener(); gpsListener = new MyGpsListener(); + gnssListener = new MyGnssListener(); // init basic fixing values isFixed = false; @@ -105,7 +108,6 @@ public GpsConnection(Context context) { // add new listener GPS try { if (Build.VERSION.SDK_INT >= 24) { - MyGnssListener gnssListener = new MyGnssListener(); locationManager.registerGnssStatusCallback(gnssListener); } else { locationManager.addGpsStatusListener(gpsListener); @@ -131,7 +133,11 @@ public void destroy() { if (locationManager != null) { disableNetwork(); locationManager.removeUpdates(llGPS); - locationManager.removeGpsStatusListener(gpsListener); + if (Build.VERSION.SDK_INT >= 24) { + locationManager.unregisterGnssStatusCallback(gnssListener); + } else { + locationManager.removeGpsStatusListener(gpsListener); + } locationManager = null; // XXX missing context to notify by widget ManagerNotify.toastShortMessage(R.string.gps_disabled); From 1ebcc979db4215ef3846907029a3258699d97600 Mon Sep 17 00:00:00 2001 From: GalateeM Date: Sat, 11 May 2024 11:19:54 +0200 Subject: [PATCH 2/2] Bug #457 - unused field removed --- .../menion/android/whereyougo/geo/location/GpsConnection.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/menion/android/whereyougo/geo/location/GpsConnection.java b/src/main/java/menion/android/whereyougo/geo/location/GpsConnection.java index 3f3b4285..aef58163 100644 --- a/src/main/java/menion/android/whereyougo/geo/location/GpsConnection.java +++ b/src/main/java/menion/android/whereyougo/geo/location/GpsConnection.java @@ -51,7 +51,6 @@ public class GpsConnection { private boolean networkProviderEnabled; private boolean gpsProviderEnabled; private GpsStatus gpsStatus; - private GnssStatus gnssStatus; public GpsConnection(Context context) { Logger.w(TAG, "onCreate()");