-
Notifications
You must be signed in to change notification settings - Fork 48
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
ACCESS_FINE_LOCATION permission exception #227
Conversation
- 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)
libtelemetry/src/main/java/com/mapbox/android/telemetry/TelemetryService.java
Outdated
Show resolved
Hide resolved
- 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); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
Detect if
ACCESS_FINE_LOCATION
permission has been removed from the manifest and throw an exception.Fixes #222