| 1234567891011121314151617181920212223242526272829303132333435 |
- package com.slam.bboxble;
- import android.content.pm.PackageManager;
- /**
- * Utility class that wraps access to the runtime permissions API in M and provides basic helper
- * methods.
- */
- public abstract class PermissionUtils {
- /**
- * Check that all given permissions have been granted by verifying that each entry in the
- * given array is of the value {@link PackageManager#PERMISSION_GRANTED}.
- *
- * @see Activity#onRequestPermissionsResult(int, String[], int[])
- */
- public static boolean verifyPermissions(int[] grantResults) {
- // At least one result must be checked.
- if (grantResults.length < 1) {
- return false;
- }
- // Verify that each required permission has been granted, otherwise return false.
- for (int result : grantResults) {
- if (result != PackageManager.PERMISSION_GRANTED) {
- return false;
- }
- }
- return true;
- }
- }
|