@ThreadSafe public final class PermissionCompat extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
PermissionCompat.PermissionStatus |
| Modifier and Type | Method and Description |
|---|---|
static PermissionCompat.PermissionStatus |
getPermissionStatus(Context context,
String permissionName)
Dynamically checks app permissions at runtime, with forward and backward
compatibility for pre-Marshmallow and post-Mashmallow permission behavior.
|
public static PermissionCompat.PermissionStatus getPermissionStatus(Context context, String permissionName)
android.support.v4.content.PermissionChecker. This
method lets SDK and app developers handle scenarios when permissions may intentionally
be omitted from the manifest.
Note that on Marshmallow, this class also correctly handles checking for Manifest.permission.WRITE_SETTINGS and
Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS.context - Application context.permissionName - Name of the permission to check.context is able to use permissionName. Note that PermissionCompat.PermissionStatus.NOT_GRANTED_BY_MANIFEST is higher
priority than PermissionCompat.PermissionStatus.NOT_GRANTED_BY_USER,
so PermissionCompat.PermissionStatus.NOT_GRANTED_BY_MANIFEST will be returned when both statuses
are true.