public final class PermissionUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areAllPermissionsGranted(android.content.Context context,
java.lang.String... permissions)
Returns, whether all permissions, which are contained by a specific array, are granted, or
not.
|
static java.lang.String[] |
getNotGrantedPermissions(android.content.Context context,
java.lang.String... permissions)
Returns the subset of specific permissions, which are not granted.
|
static boolean |
isPermissionGranted(android.content.Context context,
java.lang.String permission)
Returns, whether a specific permission is granted, or not.
|
static boolean |
shouldShowRequestPermissionRationale(android.app.Activity activity,
java.lang.String... permissions)
Returns, whether an UI with a rationale for requesting one or multiple permissions should be
shown, or not.
|
public static boolean isPermissionGranted(android.content.Context context,
java.lang.String permission)
context - The context, which should be used, as an instance of the class Context. The
context may not be nullpermission - The permission, which should be checked, as a String, e.g.
android.Manifest.permission.CALL_PHONE. The permission may neither be
null, nor emptypublic static boolean areAllPermissionsGranted(android.content.Context context,
java.lang.String... permissions)
context - The context, which should be used, as an instance of the class Context. The
context may not be nullpermissions - An array, which contains the permissions, e.g. android.Manifest.permission.CALL_PHONE,
which should be checked, as a String array. The array may not be nullpublic static java.lang.String[] getNotGrantedPermissions(android.content.Context context,
java.lang.String... permissions)
context - The context, which should be used, as an instance of the class Context. The
context may not be nullpermissions - An array, which contains the permissions, e.g. android.Manifest.CALL_PHONE,
which should be checked, as a String array. The array may not be nullString
array or an empty array, if all permissions are grantedpublic static boolean shouldShowRequestPermissionRationale(android.app.Activity activity,
java.lang.String... permissions)
activity - The activity, which should be used to show the rationale, as an instance of the class
Activity. The activity may not be nullpermissions - An array, which contains the permissions, e.g. android.Manifest.CALL_PHONE,
which should be requested, as a String array. The array may not be null