patloew/RxLocation

If targetSdk > 23, location requests produce permission errors

jeremy303 opened this issue · 3 comments

If the targetApi for the sample project is set to 24 or greater, we get this inspection error:

Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with `checkPermission`) or explicitly handle a potential `SecurityException`

on rxLocation.location().updates(...) and rxLocation.location().lastLocation() in MainPresenter.

Ideas? Thanks!

This is just a hint so that you make sure to have the appropriate permission before requesting the user's location. You can for example use RxPermissions for this or read about requesting permissions at the Android dev site.

@patloew Ah, I got you. Thanks for the clarification. I mistakenly thought checkAndHandleResolution took care of the permissions check. So checkAndHandleResolution ensures that location is enabled in settings?

checkAndHandleResolution() only handles a (possible) resolution when the location settings check fails. See the readme.