From 2bc12fe9d63ecc53375188f80df99273370933b0 Mon Sep 17 00:00:00 2001 From: andrekir Date: Tue, 4 Jan 2022 11:15:59 -0300 Subject: [PATCH] update play-services-location --- app/build.gradle | 2 +- .../main/java/com/geeksville/mesh/service/MeshService.kt | 7 +++---- .../main/java/com/geeksville/mesh/ui/SettingsFragment.kt | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 12b70ecbb..31e4224a4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -171,7 +171,7 @@ dependencies { implementation 'com.squareup.okhttp3:okhttp:4.9.0' // location services - implementation 'com.google.android.gms:play-services-location:18.0.0' + implementation 'com.google.android.gms:play-services-location:19.0.0' // For Google Sign-In (owner name accesss) implementation 'com.google.android.gms:play-services-auth:20.0.0' diff --git a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt index 5c79f1d53..4d0702ba9 100644 --- a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt +++ b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt @@ -7,6 +7,7 @@ import android.content.Context import android.content.Intent import android.content.IntentFilter import android.os.IBinder +import android.os.Looper import android.os.RemoteException import android.widget.Toast import androidx.annotation.UiThread @@ -196,6 +197,7 @@ class MeshService : Service(), Logging { * start our location requests (if they weren't already running) * * per https://developer.android.com/training/location/change-location-settings + * & https://developer.android.com/training/location/request-updates */ @SuppressLint("MissingPermission") @UiThread @@ -253,10 +255,7 @@ class MeshService : Service(), Logging { } val client = LocationServices.getFusedLocationProviderClient(this) - - // FIXME - should we use Looper.myLooper() in the third param per https://github.com/android/location-samples/blob/432d3b72b8c058f220416958b444274ddd186abd/LocationUpdatesForegroundService/app/src/main/java/com/google/android/gms/location/sample/locationupdatesforegroundservice/LocationUpdatesService.java - client.requestLocationUpdates(request, locationCallback, null) - + client.requestLocationUpdates(request, locationCallback, Looper.getMainLooper()) fusedLocationClient = client } } diff --git a/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt index 1a0685799..ce9948838 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt @@ -878,7 +878,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging { } locationSettingsResponse.addOnSuccessListener { - if (!it.locationSettingsStates.isBleUsable || !it.locationSettingsStates.isLocationUsable) + if (!it.locationSettingsStates?.isBleUsable!! || !it.locationSettingsStates?.isLocationUsable!!) weNeedAccess() else debug("We have location access")