Don't request background location permission in the foreground activities any more.

This commit is contained in:
Andreas Schildbach 2020-11-21 12:41:13 +01:00
parent 79e7a3f353
commit 44ee7a1a41
5 changed files with 5 additions and 10 deletions

View file

@ -229,8 +229,7 @@ public class DirectionsActivity extends OeffiMainActivity implements ActivityCom
locationView.acquireLocation(); locationView.acquireLocation();
else else
ActivityCompat.requestPermissions(DirectionsActivity.this, ActivityCompat.requestPermissions(DirectionsActivity.this,
new String[] { Manifest.permission.ACCESS_FINE_LOCATION, new String[] { Manifest.permission.ACCESS_FINE_LOCATION }, locationPermissionRequestCode);
Manifest.permission.ACCESS_BACKGROUND_LOCATION }, locationPermissionRequestCode);
return true; return true;
} else if (item.getItemId() == R.id.directions_location_contact) { } else if (item.getItemId() == R.id.directions_location_contact) {
startActivityForResult(new Intent(Intent.ACTION_PICK, CommonDataKinds.StructuredPostal.CONTENT_URI), startActivityForResult(new Intent(Intent.ACTION_PICK, CommonDataKinds.StructuredPostal.CONTENT_URI),

View file

@ -101,8 +101,7 @@ public class DirectionsShortcutActivity extends OeffiActivity
Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)
maybeStartLocation(); maybeStartLocation();
else else
ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.ACCESS_FINE_LOCATION, ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.ACCESS_FINE_LOCATION },
Manifest.permission.ACCESS_BACKGROUND_LOCATION },
REQUEST_CODE_REQUEST_LOCATION_PERMISSION); REQUEST_CODE_REQUEST_LOCATION_PERMISSION);
} }

View file

@ -188,8 +188,7 @@ public class NetworkPickerActivity extends Activity implements ActivityCompat.On
if (ContextCompat.checkSelfPermission(this, if (ContextCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.ACCESS_COARSE_LOCATION, ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.ACCESS_COARSE_LOCATION },
Manifest.permission.ACCESS_BACKGROUND_LOCATION },
REQUEST_CODE_REQUEST_LOCATION_PERMISSION); REQUEST_CODE_REQUEST_LOCATION_PERMISSION);
} }

View file

@ -147,8 +147,7 @@ public class PlansPickerActivity extends OeffiMainActivity implements ActivityCo
if (ContextCompat.checkSelfPermission(this, if (ContextCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.ACCESS_COARSE_LOCATION, ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.ACCESS_COARSE_LOCATION },
Manifest.permission.ACCESS_BACKGROUND_LOCATION },
REQUEST_CODE_REQUEST_LOCATION_PERMISSION); REQUEST_CODE_REQUEST_LOCATION_PERMISSION);
} }

View file

@ -247,8 +247,7 @@ public class StationsActivity extends OeffiMainActivity implements StationsAware
final Button locationPermissionRequestButton = (Button) findViewById( final Button locationPermissionRequestButton = (Button) findViewById(
R.id.stations_location_permission_request_button); R.id.stations_location_permission_request_button);
locationPermissionRequestButton.setOnClickListener(v -> ActivityCompat.requestPermissions(StationsActivity.this, locationPermissionRequestButton.setOnClickListener(v -> ActivityCompat.requestPermissions(StationsActivity.this,
new String[] { Manifest.permission.ACCESS_FINE_LOCATION, new String[] { Manifest.permission.ACCESS_FINE_LOCATION }, 0));
Manifest.permission.ACCESS_BACKGROUND_LOCATION }, 0));
final Button locationSettingsButton = (Button) findViewById(R.id.stations_list_location_settings); final Button locationSettingsButton = (Button) findViewById(R.id.stations_list_location_settings);
locationSettingsButton.setOnClickListener(v -> startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS))); locationSettingsButton.setOnClickListener(v -> startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)));