From 9b6df4bf99f91b340e82011b7bb1e1a3284e9fe7 Mon Sep 17 00:00:00 2001 From: Dennis Guse Date: Tue, 22 Aug 2023 07:15:08 +0200 Subject: [PATCH] Bugfix: request ACCESS_BACKGROUND_LOCATION fails; removing it for now. Introduced in 3910837d1aa3308738351c91208fa3b0d7ec1710 Part of #1653. --- src/main/AndroidManifest.xml | 2 +- .../java/de/dennisguse/opentracks/TrackListActivity.java | 2 +- .../dennisguse/opentracks/util/PermissionRequester.java | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 07defc13a2..391e6c6742 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -46,7 +46,7 @@ limitations under the License. - + diff --git a/src/main/java/de/dennisguse/opentracks/TrackListActivity.java b/src/main/java/de/dennisguse/opentracks/TrackListActivity.java index a3e60fd35a..bf10ba5494 100644 --- a/src/main/java/de/dennisguse/opentracks/TrackListActivity.java +++ b/src/main/java/de/dennisguse/opentracks/TrackListActivity.java @@ -276,7 +276,7 @@ public void bindView(View view, Context context, Cursor cursor) { } private void requestRequiredPermissions() { - PermissionRequester.ALL.requestPermissionsIfNeeded(this, this, null, (requester) -> Toast.makeText(this, R.string.permission_gps_failed, Toast.LENGTH_SHORT).show()); + PermissionRequester.ALL.requestPermissionsIfNeeded(this, this, null, (requester) -> Toast.makeText(this, R.string.permission_gps_failed, Toast.LENGTH_LONG).show()); } @Override diff --git a/src/main/java/de/dennisguse/opentracks/util/PermissionRequester.java b/src/main/java/de/dennisguse/opentracks/util/PermissionRequester.java index 41c3b2fab5..7a72b59ad9 100644 --- a/src/main/java/de/dennisguse/opentracks/util/PermissionRequester.java +++ b/src/main/java/de/dennisguse/opentracks/util/PermissionRequester.java @@ -60,11 +60,12 @@ private void requestPermission(ActivityResultCaller context, @Nullable Runnable private static final List GPS_PERMISSION; static { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - GPS_PERMISSION = List.of(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_BACKGROUND_LOCATION); - } else { + //TODO ACCESS_BACKGROUND_LOCATION is required for API, but the permission is not properly granted. See #1653. +// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { +// GPS_PERMISSION = List.of(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_BACKGROUND_LOCATION); +// } else { GPS_PERMISSION = List.of(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION); - } +// } } private static final List BLUETOOTH_PERMISSIONS;