Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACCESS_FINE_LOCATION permission exception #227

Merged
merged 5 commits into from
Oct 8, 2018

Conversation

electrostat
Copy link
Contributor

Detect if ACCESS_FINE_LOCATION permission has been removed from the manifest and throw an exception.

Fixes #222

- check if ACCESS_FINE_LOCATION permission is a part of the manifest
- throw exception to alert developer to cause of crash
- waiting on feedback to prevent crash or keep it (small change)
- prevent creation of passive provider, when pre-6.0 and no Fine location permission available
private boolean checkFinePermission(int finePermission) {
if (finePermission != PackageManager.PERMISSION_GRANTED) {
try {
throw new Exception(MISSING_FINE_PERMISSION);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm still not sure why we need to throw exception catch and handle it in the same method? since we're basically stuck with passive provider would it make sense just to check if fine permissions are granted and if not let the user know that we can't collect location preferably via SecurityException? Thoughts?

- replace exception with a debug log, to remove try/catch and still inform dev/us of missing permission
- reworded debug message
if (checkFinePermission(finePermission)) {
return false;
}

return coarsePermission == PackageManager.PERMISSION_GRANTED
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it actually make sense to check for coarse permission with passive provider at all?

- remove the coarse location permission
- rework `checkFinePermission` to send back appropriate bool and display message at correct time.
@electrostat electrostat merged commit 6f51664 into master Oct 8, 2018
@electrostat electrostat deleted the aa-missing-fine-location-permission-exception branch October 8, 2018 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants