android - Is ACCESS_COARSE_LOCATION necessary if the user has already granted ACCESS_FINE_LOCATION? -
i updating app work new android marshmallow permission framework , looks it's enough user grant access_fine_location permission @ runtime app work fine. do:
public static final string[] runtimepermissions = { permission.access_fine_location }; public static final int location_permission_identifier = 1;
and further down class:
public static boolean checkconnectionpermission(final context context) { if (build.version.sdk_int > build.version_codes.lollipop_mr1) { if (context.checkselfpermission(permission.access_fine_location) == packagemanager.permission_granted) { return true; } else { ((activity) context).requestpermissions(runtimepermissions, location_permission_identifier); return false; } } // since in api levels below m permission granted on // installation, // considered given permission has been granted since // // app running. return true default else { return true; } }
i concerned overlooking cause trouble in future (the app near-production) security exception(s).
i guess ultimate question is: granting fine_location somehow auto-grant coarse_location too?
sort of answered here.
if have access_fine_location already, can omit access_coarse_location?
some additional information, should @ permission group.
https://developer.android.com/preview/features/runtime-permissions.html
they in same permission group. if want play safe, include both in manifest, , request them on need. transparent user.
Comments
Post a Comment