Skip to content

Commit

Permalink
Bugfix: request ACCESS_BACKGROUND_LOCATION fails; removing it for now.
Browse files Browse the repository at this point in the history
Introduced in 3910837

Part of #1653.
  • Loading branch information
dennisguse committed Aug 22, 2023
1 parent 73f325e commit 9b6df4b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ limitations under the License.

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<!-- <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />-->
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ private void requestPermission(ActivityResultCaller context, @Nullable Runnable
private static final List<String> 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<String> BLUETOOTH_PERMISSIONS;
Expand Down

0 comments on commit 9b6df4b

Please sign in to comment.